123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\api\controller\h5;
- use app\hander\HelpHander;
- use think\App;
- use think\Controller;
- use think\Db;
- class ShopDay extends Base
- {
- public function __construct(App $app = null) {
- parent::__construct($app);
- $this->model = new \app\common\model\ShopDay();
- }
- public function date(){
- $ret = $this->model->shopDate();
- HelpHander::success($ret);
- }
- public function cate(){
- $type = input('type/d',0);
- $ret = $this->model->cate_old($type,3);
- HelpHander::success($ret);
- }
- public function goods(){
- $type = input('type/d',0);
- $cate_id = input('cate_id/d',0);
- $ret = $this->model->goods_old($type,$cate_id,3);
- HelpHander::success($ret);
- }
- // 获取类型
- public function types(){
- $day = input('day/s','','trim');
- if(!$day){
- HelpHander::error('参数错误');
- }
- $lists = Db::name('shop_day')
- ->where('org_id',$this->orgId)
- ->where('day',$day)
- ->field('id,cate')
- ->order('cate asc')
- ->select();
- $lists = $lists?$lists:[];
- foreach ($lists as $k=>$v){
- if($v['cate'] == 1){
- $lists[$k]['name'] = "早餐";
- }else if($v['cate'] == 2){
- $lists[$k]['name'] = "午餐";
- }else if($v['cate'] == 3){
- $lists[$k]['name'] = "晚餐";
- }else if($v['cate'] == 4){
- $lists[$k]['name'] = "当日餐";
- }
- }
- HelpHander::success($lists);
- }
- }
|