ShopOrder.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\api\controller\h5;
  3. use app\hander\HelpHander;
  4. use app\common\model\ShopOrders;
  5. class ShopOrder extends Base
  6. {
  7. public function addOrder(){
  8. $addressid = input('address_id/d',0);
  9. $delivery_time = input('delivery_time','','trim');
  10. $type = input('type/d',0);
  11. $json = input('json','','trim');
  12. if($addressid <= 0){
  13. HelpHander::error('未选择收货地址');
  14. }
  15. if(!$delivery_time){
  16. HelpHander::error('未选择配送时间');
  17. }
  18. if($type <= 0){
  19. HelpHander::error('未选择类型');
  20. }
  21. if(!$json){
  22. HelpHander::error('商品信息不能为空');
  23. }
  24. $so = new ShopOrders();
  25. $ret = $so->addOrder_old($json,$addressid,$this->orgId,$this->userId,$delivery_time,$type);
  26. if(!$ret){
  27. HelpHander::error($so->getError());
  28. }
  29. HelpHander::success($ret);
  30. }
  31. public function orderList(){
  32. $page = input('page/d',1);
  33. $size = input('size/d',10);
  34. $so = new ShopOrders();
  35. $ret = $so->list($page,$size,$this->userId,$this->orgId);
  36. HelpHander::success($ret);
  37. }
  38. public function orderDetails(){
  39. $id = input('id/d',0);
  40. $so = new ShopOrders();
  41. $ret = $so->details($id);
  42. if(!$ret){
  43. HelpHander::error('数据不存在');
  44. }
  45. HelpHander::success($ret);
  46. }
  47. public function cancel(){
  48. $id = input('id/d',0);
  49. $so = new ShopOrders();
  50. $ret = $so->cancel($id,$this->userId);
  51. if(!$ret){
  52. HelpHander::error('操作失败');
  53. }
  54. HelpHander::success([],'操作成功');
  55. }
  56. }