优化汇总

master
chenzhi 4 years ago
parent abb88719b5
commit 6c46dd0ea5

@ -266,12 +266,13 @@ class FinancialSummarySetController extends \Think\Controller
*/ */
public function setPromoteMoney() public function setPromoteMoney()
{ {
$SpendModel = SM("spend",'tab_');
$map = array( $map = array(
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), "payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1, "pay_status"=>1,
); );
D("Spend")->addSubsiteWhere($map,"s"); D("Spend")->addSubsiteWhere($map,"s");
$res = $this->SpendModel $res = $SpendModel
->alias('s') ->alias('s')
->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count, ->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,
IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count, IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count,
@ -358,7 +359,7 @@ class FinancialSummarySetController extends \Think\Controller
$unmap = $map; $unmap = $map;
$unmap['is_check'] = 2; $unmap['is_check'] = 2;
$unSettlementRes = $this->SpendModel $unSettlementRes = $SpendModel
->alias('s') ->alias('s')
->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count, ->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,
IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count, IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count,

Loading…
Cancel
Save