edit-api-sum_deal_log
This commit is contained in:
@@ -19,6 +19,10 @@ class Statistics extends Wxapp{
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model('auto/auto_attr_model');
|
||||
|
||||
$this->load->model('app/deal_log_model');
|
||||
|
||||
$this->load->library('entity/deal_entity',['app_id'=>$this->app_id]);
|
||||
}
|
||||
|
||||
protected function get(){
|
||||
@@ -63,6 +67,7 @@ class Statistics extends Wxapp{
|
||||
$rows = $this->auto_brand_model->select($where,'',$page,$size,$fileds);
|
||||
$list = [];
|
||||
if($rows){
|
||||
$res = $this->deal_entity->deal_log($oid);
|
||||
foreach($rows as $key => $val){
|
||||
$enroll = $this->clues_model->count(['app_id'=>$this->app_id,'recommend_id'=>$uid,'brand_id'=>$val['id']]);
|
||||
$where = [
|
||||
@@ -77,13 +82,18 @@ class Statistics extends Wxapp{
|
||||
'lc_receiver_orders.status>' => 0
|
||||
];
|
||||
$ispay = $this->clues_model->count_order($where);
|
||||
$commision = 0;
|
||||
$where = [
|
||||
'lc_app_deal_log.status' => 1,
|
||||
'lc_app_deal_log.app_uid' => $uid,
|
||||
'lc_receiver_orders.brand_id' => $val['id'],
|
||||
];
|
||||
$done_commision = $this->deal_entity->sum_done($where);
|
||||
$list[] = [
|
||||
'title' => $val['name'],
|
||||
'enroll' => $enroll,
|
||||
'ispay' => $ispay,
|
||||
'done' => $done,
|
||||
'commision' => number_format($done*500,2)
|
||||
'commision' => number_format($done_commision,2)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,6 +490,9 @@ class Cusorder extends Wxapp{
|
||||
$result = $this->order_deliverys_model->update(['status'=>2],['id'=>$row['id']]);
|
||||
if($result){
|
||||
$this->orders_model->update(['status'=>6],['id'=>$row['o_id']]);
|
||||
//完成分销
|
||||
$this->load->library('entity/deal_entity',['app_id'=>1]);
|
||||
$this->deal_entity->deal_log_finish($row['o_id']);
|
||||
throw new Exception('修改成功', API_CODE_SUCCESS);
|
||||
}else{
|
||||
throw new Exception('修改失败', ERR_PARAMS_ERROR);
|
||||
|
||||
@@ -273,6 +273,16 @@ class Deal_entity
|
||||
}
|
||||
}
|
||||
|
||||
//统计完成订单金额
|
||||
public function sum_done($where=[]){
|
||||
$this->ci->db->from('lc_app_deal_log');
|
||||
$this->ci->db->join('lc_receiver_orders', "lc_receiver_orders.sid = lc_app_deal_log.cf_sid");
|
||||
$this->ci->db->select_sum('lc_app_deal_log.money');
|
||||
$this->ci->db->where($where);
|
||||
$result = $this->ci->db->get()->row_array();
|
||||
return $result['money'] ? $result['money'] : 0;
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if ('_model' === substr($name, -6)) {
|
||||
|
||||
Reference in New Issue
Block a user