正在显示
3 个修改的文件
包含
52 行增加
和
1 行删除
@@ -52,7 +52,7 @@ class OrderpageController extends WeChatBaseController{ | @@ -52,7 +52,7 @@ class OrderpageController extends WeChatBaseController{ | ||
52 | } | 52 | } |
53 | 53 | ||
54 | /** | 54 | /** |
55 | - * 显示业务员统一订单页 | 55 | + * 显示业务员统一订单页mmmmm |
56 | */ | 56 | */ |
57 | public function order_salesman_ty(){ | 57 | public function order_salesman_ty(){ |
58 | 58 |
@@ -101,6 +101,55 @@ class PayController extends HomeBaseController | @@ -101,6 +101,55 @@ class PayController extends HomeBaseController | ||
101 | // $update['status']=9; | 101 | // $update['status']=9; |
102 | // } | 102 | // } |
103 | // Db::name('order')->where('order_sn',$out_trade_no)->update($update); | 103 | // Db::name('order')->where('order_sn',$out_trade_no)->update($update); |
104 | + $out_trade_no=$notify->out_trade_no; | ||
105 | + //查询订单信息 | ||
106 | + $order = Db::name('indent')->where('order_number',$out_trade_no)->find(); | ||
107 | + if($successful){ | ||
108 | + $update['state'] = 2; | ||
109 | + //更新订单状态为待发货 | ||
110 | + Db::name('indent')->where('order_number',$out_trade_no)->update($update); | ||
111 | + $uid = cmf_get_current_user_id(); | ||
112 | + //查询当前用户身份 | ||
113 | + $data_user = Db::name('my_user')->where('uid',$uid)->find(); | ||
114 | + if($order['indent_type'] == 1){ | ||
115 | + //如果是平台商品 学生购买 | ||
116 | + if($data_user['status'] == 4){ | ||
117 | + //查询平台商品老师和业务员所占的佣金比例 | ||
118 | + $money_ratio = Db::name('money_ratio') -> where('id',1) -> find(); | ||
119 | + //查询这条订单下的所有商品 | ||
120 | + $data_indent_goods = Db::name('indent_goods') -> where('indent_id',$order['id']) -> select(); | ||
121 | + $money_salesman = 0; | ||
122 | + //查询老师的uid | ||
123 | + $teacher = Db::name('my_user') -> where('id',$data_user['pid']) -> find(); | ||
124 | + //查询业务员的uid | ||
125 | + $salesman = Db::name('my_user') -> where('id',$teacher['pid']) -> find(); | ||
126 | + foreach ($data_indent_goods as $key => $val){ | ||
127 | + $money_salesman += $val['price']*$val['number']*$money_ratio['salesman_ratio']; | ||
128 | + $data_money_income_salesman['create_time'] = time(); | ||
129 | + $data_money_income_salesman['money'] = $money_salesman; | ||
130 | + $data_money_income_salesman['type'] = 1; | ||
131 | + $data_money_income_salesman['book_name'] = $val['book_name']; | ||
132 | + $data_money_income_salesman['book_thumbnail'] = $val['thumbnail']; | ||
133 | + $data_money_income_salesman['book_num'] = $val['number']; | ||
134 | + $data_money_income_salesman['uid'] = $salesman['uid']; | ||
135 | + Db::name('money_income') -> insert($data_money_income_salesman); | ||
136 | + } | ||
137 | + Db::name('my_user') -> where('uid',$salesman['uid']) -> setInc('balance',$money_salesman); | ||
138 | + $money_teacher = 0; | ||
139 | + foreach ($data_indent_goods as $key => $val){ | ||
140 | + $money_teacher += $val['price']*$val['number']*$money_ratio['teacher_ratio']; | ||
141 | + $data_money_income_teacher | ||
142 | + } | ||
143 | + } | ||
144 | + //如果是平台商品 老师购买 | ||
145 | + if($data_user['status'] == 3){ | ||
146 | + | ||
147 | + } | ||
148 | + }else if($order['indent_type'] == 2){ | ||
149 | + | ||
150 | + } | ||
151 | + | ||
152 | + } | ||
104 | 153 | ||
105 | return true; // 返回处理完成 | 154 | return true; // 返回处理完成 |
106 | }); | 155 | }); |
@@ -150,6 +150,7 @@ class ShopcartController extends WeChatBaseController{ | @@ -150,6 +150,7 @@ class ShopcartController extends WeChatBaseController{ | ||
150 | $indent_goods['number'] = $val['book_num']; | 150 | $indent_goods['number'] = $val['book_num']; |
151 | $indent_goods['thumbnail'] = $val['show_img']; | 151 | $indent_goods['thumbnail'] = $val['show_img']; |
152 | $indent_goods['indent_id'] = $indet_id; | 152 | $indent_goods['indent_id'] = $indet_id; |
153 | + $indent_goods['commission'] = $val['money']; | ||
153 | Db::name('indent_goods ') -> insert($indent_goods); | 154 | Db::name('indent_goods ') -> insert($indent_goods); |
154 | } | 155 | } |
155 | $ret['type'] = 1; | 156 | $ret['type'] = 1; |
@@ -177,6 +178,7 @@ class ShopcartController extends WeChatBaseController{ | @@ -177,6 +178,7 @@ class ShopcartController extends WeChatBaseController{ | ||
177 | $indent_goods['number'] = $val['book_num']; | 178 | $indent_goods['number'] = $val['book_num']; |
178 | $indent_goods['thumbnail'] = $val['show_img']; | 179 | $indent_goods['thumbnail'] = $val['show_img']; |
179 | $indent_goods['indent_id'] = $indet_id; | 180 | $indent_goods['indent_id'] = $indet_id; |
181 | + $indent_goods['commission'] = $val['money']; | ||
180 | Db::name('indent_goods ') -> insert($indent_goods); | 182 | Db::name('indent_goods ') -> insert($indent_goods); |
181 | } | 183 | } |
182 | $ret['type'] = 2; | 184 | $ret['type'] = 2; |
-
请 注册 或 登录 后发表评论