123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class DinnerOrders extends Base
- {
- // 列表
- public function list(){
- $ret = model('DinnerOrders')->lists();
- HelpHander::success($ret);
- }
- public function export(){
- $ret = model('DinnerOrders')->export();
- HelpHander::success($ret);
- }
- public function apply(){
- $ret = model('DinnerOrders')->applys($this->userId);
- HelpHander::success($ret);
- }
- public function applyexport(){
- $ret = model('DinnerOrders')->applyexport($this->userId);
- HelpHander::success($ret);
- }
- public function agree(){
- $id = input('id/d',0);
- model('DinnerOrders')->agree($id,$this->userId);
- HelpHander::success([],'操作成功');
- }
- public function agreeall(){
- model('DinnerOrders')->agreeall($this->userId);
- HelpHander::success([],'操作成功');
- }
- // 删除
- public function del(){
- $id = input('id/d',0);
- model('DinnerOrders')->del($id,$this->userId);
- HelpHander::success([],'操作成功');
- }
- // 删除订单商品
- public function delgoods(){
- $id = input('id/d',0);
- model('DinnerOrders')->delgoods($id,$this->userId);
- HelpHander::success([],'操作成功');
- }
- // 修改商品数量
- public function editgoods(){
- $id = input('id/d',0);
- $nums = input('nums/d',0);
- model('DinnerOrders')->editgoods($id,$nums,$this->userId);
- HelpHander::success([],'操作成功');
- }
- // 添加商品
- public function addgoods(){
- $orderId = input('orderId/d',0);
- $dinnerId = input('dinnerId/d',0);
- $nums = input('nums/d',0);
- model('DinnerOrders')->addgoods($orderId,$dinnerId,$nums,$this->userId);
- HelpHander::success([],'操作成功');
- }
- public function goods(){
- $orderId = input('orderId/d',0);
- $m[] = ['a.order_id','=',$orderId];
- $goods = Db::name('dinner_order_goods')
- ->alias('a')
- ->join('dinner_cate c','c.id = a.cate_id')
- ->join('dinner e','e.id = a.dinner_id')
- ->where($m)
- ->order('a.cate_id asc')
- ->field('a.*,c.title as cate_title,e.title as dinner_title,c.color')
- ->select();
- $goods = $goods?$goods:[];
- HelpHander::success($goods,'成功');
- }
- // 配菜表
- public function pclist(){
- $ret = model('DinnerOrders')->pclists();
- HelpHander::success($ret);
- }
- // 配菜表导出
- public function pcexport(){
- $ret = model('DinnerOrders')->pcexport();
- HelpHander::success($ret);
- }
- // 财务报表
- public function finance(){
- $ret = model('DinnerOrders')->finance();
- HelpHander::success($ret);
- }
- // 财务报表
- public function finexport(){
- $ret = model('DinnerOrders')->finexport();
- HelpHander::success($ret);
- }
- // 公司财务报表
- public function cfinance(){
- $ret = model('DinnerOrders')->cfinance($this->userId);
- HelpHander::success($ret);
- }
- // 公司财务报表
- public function cfinexport(){
- $ret = model('DinnerOrders')->cfinexport($this->userId);
- HelpHander::success($ret);
- }
- }
|