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

4

@@ -149,11 +149,7 @@ class OrderpageController extends WeChatBaseController{ @@ -149,11 +149,7 @@ class OrderpageController extends WeChatBaseController{
149 149
150 $_POST['is_courier'] = 2; 150 $_POST['is_courier'] = 2;
151 $data_update = Db::name('indent') -> update($_POST); 151 $data_update = Db::name('indent') -> update($_POST);
152 - if($data_update){  
153 - return true;  
154 - }else{  
155 - return false;  
156 - } 152 + return true;
157 153
158 } 154 }
159 155
@@ -178,11 +174,7 @@ class OrderpageController extends WeChatBaseController{ @@ -178,11 +174,7 @@ class OrderpageController extends WeChatBaseController{
178 public function goods_leave_word_update(){ 174 public function goods_leave_word_update(){
179 175
180 $data = Db::name('indent') -> update($_POST); 176 $data = Db::name('indent') -> update($_POST);
181 - if($data){  
182 - return true;  
183 - }else{  
184 - return false;  
185 - } 177 + return true;
186 178
187 } 179 }
188 180
@@ -190,6 +190,20 @@ class ShopcartController extends WeChatBaseController{ @@ -190,6 +190,20 @@ class ShopcartController extends WeChatBaseController{
190 190
191 } 191 }
192 192
  193 + /**
  194 + * 业务员不能买书
  195 + */
  196 + public function is_to_pay(){
  197 +
  198 + $uid = cmf_get_current_user_id();
  199 + $my_user = Db::name('my_user') -> where('uid',$uid) -> find();
  200 + if($my_user['status'] == 2){
  201 + return false;
  202 + }else{
  203 + return true;
  204 + }
  205 +
  206 + }
193 207
194 208
195 209
@@ -140,20 +140,27 @@ @@ -140,20 +140,27 @@
140 if(goods_id.length == 0){ 140 if(goods_id.length == 0){
141 alert('不能为空'); 141 alert('不能为空');
142 }else{ 142 }else{
143 - goods_id = goods_id.join(',');  
144 - myprice = $('#myprice').text();  
145 - $.post("{:url('Shopcart/shop_cart_pay')}",{id:goods_id,myprice:myprice},function(data){  
146 - obj = JSON.parse(data);  
147 - if(obj.type == 3){  
148 - alert('业务员商品和平台商品不能同时购买!');  
149 - }else if(obj.type == 1){  
150 - window.location.href = "{:url('Orderpage/order_page')}?indet_id="+obj.indet_id;  
151 - }else if(obj.type == 2){  
152 - window.location.href = "{:url('Orderpage/order_salesman_ty')}?indet_id="+obj.indet_id;  
153 - } 143 + $.post("{:url('Shopcart/is_to_pay')}",{},function(data){
  144 + if(data){
  145 + goods_id = goods_id.join(',');
  146 + myprice = $('#myprice').text();
  147 + $.post("{:url('Shopcart/shop_cart_pay')}",{id:goods_id,myprice:myprice},function(data){
  148 + obj = JSON.parse(data);
  149 + if(obj.type == 3){
  150 + alert('业务员商品和平台商品不能同时购买!');
  151 + }else if(obj.type == 1){
  152 + window.location.href = "{:url('Orderpage/order_page')}?indet_id="+obj.indet_id;
  153 + }else if(obj.type == 2){
  154 + window.location.href = "{:url('Orderpage/order_salesman_ty')}?indet_id="+obj.indet_id;
  155 + }
154 156
  157 + });
  158 + }else{
  159 + alert('业务员不能购买书籍');
  160 + }
155 }); 161 });
156 162
  163 +
157 } 164 }
158 165
159 } 166 }
@@ -204,8 +204,8 @@ class WeChatBaseController extends BaseController @@ -204,8 +204,8 @@ class WeChatBaseController extends BaseController
204 */ 204 */
205 public function checkWeChatUserLogin() 205 public function checkWeChatUserLogin()
206 { 206 {
207 - $user = Db::name('user')->where('id',2)->find();  
208 - cmf_update_current_user($user); 207 + /*$user = Db::name('user')->where('id',2)->find();
  208 + cmf_update_current_user($user);*/
209 $userId = cmf_get_current_user_id(); 209 $userId = cmf_get_current_user_id();
210 if (empty($userId)) { 210 if (empty($userId)) {
211 $config = [ 211 $config = [