IndexCountroller.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace app\api\controller\company;
  3. use app\models\store\StoreService;
  4. use app\models\system\SystemStore;
  5. use app\models\system\SystemStoreMember;
  6. use app\models\system\SystemStoreStaff;
  7. use app\models\system\SystemStoreStock;
  8. use app\Request;
  9. use crmeb\services\UtilService;
  10. class IndexCountroller
  11. {
  12. /**
  13. * 获取商品库存
  14. * @param Request $request
  15. * @return mixed
  16. */
  17. public function goods(Request $request)
  18. {
  19. $uid = $request->uid();
  20. if (!StoreService::orderServiceStatus($uid))
  21. return app('json')->fail('权限不足');
  22. $where = UtilService::getMore(
  23. [
  24. ['page',1],
  25. ['limit',10],
  26. ['key',''],
  27. ['is_warn',0],
  28. ],$request
  29. );
  30. $info = SystemStoreStaff::where('uid',$uid)->find()->toArray();
  31. $where['store_id'] = $info['store_id'];
  32. @file_put_contents("aa.txt",json_encode($where));
  33. return app('json')->successful(SystemStoreStock::lst($where));
  34. }
  35. /**
  36. * 门店会员
  37. * @param Request $request
  38. * @return mixed
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. */
  43. public function member(Request $request)
  44. {
  45. $uid = $request->uid();
  46. if (!StoreService::orderServiceStatus($uid))
  47. return app('json')->fail('权限不足');
  48. $where = UtilService::getMore(
  49. [
  50. ['limit',10],
  51. ['page',1],
  52. ['key',''],
  53. ],$request
  54. );
  55. $info = SystemStoreStaff::where('uid',$uid)->find()->toArray();
  56. $where['store_id'] = $info['store_id'];
  57. return app('json')->successful(SystemStoreMember::lst($where));
  58. }
  59. /**
  60. * 我的门店
  61. * @param Request $request
  62. * @return mixed
  63. * @throws \think\db\exception\DataNotFoundException
  64. * @throws \think\db\exception\DbException
  65. * @throws \think\db\exception\ModelNotFoundException
  66. */
  67. public function store(Request $request)
  68. {
  69. $uid = $request->uid();
  70. if (!StoreService::orderServiceStatus($uid))
  71. return app('json')->fail('权限不足');
  72. $info = SystemStoreStaff::where('uid',$uid)->find()->toArray();
  73. return app('json')->successful(SystemStore::where('id',$info['store_id'])->find()->toArray());
  74. }
  75. }