12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2020-09-29
- * Time: 8:45
- */
-
- namespace app\back\controller;
-
-
- use app\back\model\JsCallModel;
- use cmf\controller\AdminBaseController;
- use app\back\model\JsOrderModel;
- use think\Db;
- class CallController extends AdminBaseController
- {
- public function index()
- {
- $where = [];
- $pw = [];
- $page = $this->request->param('page',1);
- $admin_is_look = $this->request->param('admin_is_look');
- if($admin_is_look || $admin_is_look != ''){
- $where['admin_is_look'] = $admin_is_look;
- $pw['admin_is_look'] = $admin_is_look;
- $this->assign('admin_is_look',$admin_is_look);
- }
- $agency_is_look = $this->request->param('agency_is_look');
- if($agency_is_look || $agency_is_look != ''){
- $where['agency_is_look'] = $agency_is_look;
- $pw['agency_is_look'] = $agency_is_look;
- $this->assign('agency_is_look',$agency_is_look);
- }
-
- $list = Db::name('js_call')->where($where)
- ->field('t.*,t1.mobile as user_mobile,t1.user_nickname,t2.order_sn,t2.district,t2.address1,t2.delete_time as order_delete_time')
- ->alias('t')
- ->join('user t1','t.user_id = t1.id','left')
- ->join('js_order t2','t.order_id = t2.id AND t2.delete_time is NULL','left')
- ->order('t.id','desc')
- ->paginate(30,false,array($page,url('index'),'query'=>$pw));
- $this->assign('list',$list);
- $this->assign('action',$this->request->action());
- $this->assign('page',$list->render());
- return $this->fetch();
-
- }
-
- public function look()
- {
- $id = $this->request->param('id');
- $info = JsCallModel::get($id,['jsorder'=>['project','xiadanUser'],'user.js']);
-
- // $info->jsorder->project;
- // $info->jsorder->xiadanUser;
- // $info->user->js;
- $this->assign('info',$info);
- return $this->fetch();
-
- }
-
- public function lookPost()
- {
- $id = $this->request->param('id');
- $JsCallModel = new JsCallModel();
- $JsCallModel->allowField(true)->isUpdate(true)->save(['admin_is_look_time'=>time(),'admin_is_look'=>1],['id'=>$id]);
- $this->success('操作成功');
- }
-
- public function num()
- {
- $num = $this->request->param('num');
- $JsCallModel = new JsCallModel();
- $shishi_num = $JsCallModel::where('admin_is_look',0)->count();
- if($shishi_num > $num){
- return ['code'=>1,'shishi_num'=>$shishi_num];
- }else{
- return ['code'=>0];
- }
-
- }
- public function neworder()
- {
- $last_time = file_exists('lasttime.log')?file_get_contents('lasttime.log'):time()-360*24*60*60;
- file_put_contents('lasttime.log',time());
- $JsOrderModel = new JsOrderModel();
- $shishi_num = $JsOrderModel::where('create_time','>',$last_time)->count();
- if($shishi_num > 0){
- return ['code'=>1,'shishi_num'=>$shishi_num];
- }else{
- return ['code'=>0];
- }
-
- }
- }
|