1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\api\controller\company;
- use app\models\store\StoreService;
- use app\models\system\SystemStore;
- use app\models\system\SystemStoreMember;
- use app\models\system\SystemStoreStaff;
- use app\models\system\SystemStoreStock;
- use app\Request;
- use crmeb\services\UtilService;
- class IndexCountroller
- {
- /**
- * 获取商品库存
- * @param Request $request
- * @return mixed
- */
- public function goods(Request $request)
- {
- $uid = $request->uid();
- if (!StoreService::orderServiceStatus($uid))
- return app('json')->fail('权限不足');
- $where = UtilService::getMore(
- [
- ['page',1],
- ['limit',10],
- ['key',''],
- ['is_warn',0],
- ],$request
- );
- $info = SystemStoreStaff::where('uid',$uid)->find()->toArray();
- $where['store_id'] = $info['store_id'];
- @file_put_contents("aa.txt",json_encode($where));
- return app('json')->successful(SystemStoreStock::lst($where));
- }
- /**
- * 门店会员
- * @param Request $request
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function member(Request $request)
- {
- $uid = $request->uid();
- if (!StoreService::orderServiceStatus($uid))
- return app('json')->fail('权限不足');
- $where = UtilService::getMore(
- [
- ['limit',10],
- ['page',1],
- ['key',''],
- ],$request
- );
- $info = SystemStoreStaff::where('uid',$uid)->find()->toArray();
- $where['store_id'] = $info['store_id'];
- return app('json')->successful(SystemStoreMember::lst($where));
- }
- /**
- * 我的门店
- * @param Request $request
- * @return mixed
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function store(Request $request)
- {
- $uid = $request->uid();
- if (!StoreService::orderServiceStatus($uid))
- return app('json')->fail('权限不足');
- $info = SystemStoreStaff::where('uid',$uid)->find()->toArray();
- return app('json')->successful(SystemStore::where('id',$info['store_id'])->find()->toArray());
- }
- }
|