优化生成数据

master
chenzhi 5 years ago
parent 8796458ead
commit 3983a086ac

@ -590,11 +590,14 @@ class SpendCountSetController extends \Think\Controller
{ {
$map = array( $map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"status"=>1
); );
$add = M("provide_user","tab_")->field("sum(amount) amount")->where($map)->find()['amount']; $add = M("provide_user","tab_")->field("sum(amount) amount")->where($map)->find()['amount'];
$add || $add=0; $add || $add=0;
$jq = M("user_coin","tab_")->field("sum(num) num")->where($map)->find()['num']; $jq = M("user_coin","tab_")->field("sum(num) num")->where(array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
))->find()['num'];
$jq || $jq=0; $jq || $jq=0;
return $add-$jq; return $add-$jq;
} }
@ -603,11 +606,14 @@ class SpendCountSetController extends \Think\Controller
{ {
$map = array( $map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)), "create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"status"=>1
); );
$add = M("provide","tab_")->field("sum(amount) amount")->where($map)->find()['amount']; $add = M("provide","tab_")->field("sum(amount) amount")->where($map)->find()['amount'];
$add || $add=0; $add || $add=0;
$jq = M("deduct_bind_record","tab_")->field("sum(quantity) quantity")->where($map)->find()['quantity']; $jq = M("deduct_bind_record","tab_")->field("sum(quantity) quantity")->where(array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
))->find()['quantity'];
$jq || $jq=0; $jq || $jq=0;
return $add-$jq; return $add-$jq;
} }

Loading…
Cancel
Save