作者 anyv
1 个管道 的构建 通过 耗费 2 秒

支付加销量

... ... @@ -377,14 +377,14 @@ class IndexController extends WeChatBaseController
if($user['status'] == 0 || $user['status'] == 1 || $user['status'] == 5 || $user['status'] == 6){
$salesman_goods = null;
}elseif ($user['status'] == 2){
$salesman_goods = Db::name('goods') -> where('uid',$uid) -> select() -> toArray();
$salesman_goods = Db::name('goods') -> where('uid',$uid) -> order("sort desc") -> select() -> toArray();
}elseif ($user['status'] == 3){
$salesman_id = Db::name('my_user') -> where('id',$user['pid']) -> find();
$salesman_goods = Db::name('goods') -> where('uid',$salesman_id['uid']) -> select() -> toArray();
$salesman_goods = Db::name('goods') -> where('uid',$salesman_id['uid']) -> order("sort desc") -> select() -> toArray();
}elseif ($user['status'] == 4){
$teacher_id = Db::name('my_user') -> where('id',$user['pid']) -> find();
$salesman_id = Db::name('my_user') -> where('id',$teacher_id['pid']) -> find();
$salesman_goods = Db::name('goods') -> where('uid',$salesman_id['uid']) -> select() -> toArray();
$salesman_goods = Db::name('goods') -> where('uid',$salesman_id['uid']) -> order("sort desc") -> select() -> toArray();
}
if(!empty($salesman_goods)){
foreach ($salesman_goods as $key => $val){
... ...
... ... @@ -90,6 +90,11 @@ class PayController extends HomeBaseController
if (!$order) { // 如果订单不存在
return 'Order not exist.'; // 告诉微信,我已经处理完了,订单没找到,别再通知我了
}
//查询订单下的所有商品 增加销量
$order_indent_goods_data = Db::name('indent_goods') -> where('indent_id',$order['id']) -> select();
foreach ($order_indent_goods_data as $key => $val){
Db::name('goods') -> where('id',$val['goods_id']) -> setInc('sales',$val['number']);
}
if($successful){
Db::startTrans();
try {
... ...
... ... @@ -501,6 +501,9 @@ class PersonalcenterController extends WeChatBaseController{
}
}
if(empty($res)){
$res = null;
}
$this -> assign('res',$res);
return $this -> fetch();
... ... @@ -571,7 +574,7 @@ class PersonalcenterController extends WeChatBaseController{
//查询业务员下级所有老师的订单
$teacher_user = Db::name('my_user') -> where("pid",$my_user['id']) -> select() -> toArray();
foreach ($teacher_user as $key => $val){
$teacher_indent[$key] = Db::name('indent') -> where("indent_type=1 and uid=".$val['uid']) -> select() -> toArray();
$teacher_indent[$key] = Db::name('indent') -> where("indent_type=1 and uid=".$val['uid']) -> where("state = 2 or state = 3 or state = 5") -> select() -> toArray();
foreach ($teacher_indent[$key] as $key1 => $val1){
$money_income = Db::name('money_income') -> where("indent_id=".$val1['id']." and uid=".$my_user['uid']) -> select();
foreach ($money_income as $key3 => $val3){
... ... @@ -585,7 +588,7 @@ class PersonalcenterController extends WeChatBaseController{
$student[$key] = Db::name('my_user') -> where("pid",$val['id']) -> select();
//查询学生的所有订单
foreach ($student[$key] as $key1 => $val1){
$student_indent[$key1] = Db::name('indent') -> where("indent_type=1 and uid=".$val1['uid']) -> select();
$student_indent[$key1] = Db::name('indent') -> where("indent_type=1 and uid=".$val1['uid']) -> where("state = 2 or state = 3 or state = 5") -> select();
//查询学生订单下属于业务员的收入记录
foreach ($student_indent[$key1] as $key2 => $val2){
$student_money_income = Db::name('money_income') -> where("indent_id=".$val2['id']." and uid=".$my_user['uid']) -> select();
... ... @@ -595,6 +598,9 @@ class PersonalcenterController extends WeChatBaseController{
}
}
}
if(empty($platform_money)){
$platform_money = null;
}
$this -> assign('platform_money',$platform_money);
}else{
$this -> error('非业务员不能进去此页');
... ... @@ -624,8 +630,6 @@ class PersonalcenterController extends WeChatBaseController{
return false;
}
}
... ...
... ... @@ -152,6 +152,7 @@ class ShopcartController extends WeChatBaseController{
$indent_goods['thumbnail'] = $val['show_img'];
$indent_goods['indent_id'] = $indet_id;
$indent_goods['commission'] = $val['money'];
$indent_goods['goods_id'] = $val['id'];
Db::name('indent_goods ') -> insert($indent_goods);
}
$ret['type'] = 1;
... ... @@ -180,6 +181,7 @@ class ShopcartController extends WeChatBaseController{
$indent_goods['thumbnail'] = $val['show_img'];
$indent_goods['indent_id'] = $indet_id;
$indent_goods['commission'] = $val['money'];
$indent_goods['goods_id'] = $val['id'];
Db::name('indent_goods ') -> insert($indent_goods);
}
$ret['type'] = 2;
... ...
... ... @@ -106,7 +106,7 @@
</div>
</a>
<if condition="$status eq 3">
<a href="w_mention.html">
<a href="{:url('Personalcenter/income_record')}">
<div class="log_nine_list_one">
<div class="log_nine_list_one_left">
<div class="log_nine_list_one_left_img">
... ...
... ... @@ -121,7 +121,7 @@
<p>分类</p>
</li>
</a>
<a href="w_shopping_cart.html">
<a href="{:url('Shopcart/shop_cart')}">
<li>
<img src="__TMPL__/public/assets/images/17.png" alt="" />
<p>购物车</p>
... ...
... ... @@ -32,7 +32,9 @@
<body>
<!-- 顶部 -->
<div class="order_top" style="background-color: #FF5C19">
<a href="javascript:history.back(-1)">
<img src="__TMPL__/public/assets/images/left2.png" alt="">
</a>
<p style="color:white">我的推广</p>
</div>
<div class="code_Box">
... ...