ajaxReturn($rt); } else { if (in_array($interface, $this->interfacearr)) { if(!I('post.store_id')) $_POST['store_id'] = I('post.storeid'); if(!I('post.merchant_id')) $_POST['merchant_id'] = I('post.merchantid'); self::$interface(); } else { $rt['status'] = 0; $rt['msg'] = '接口不存在'; $this->ajaxReturn($rt); } } } public function android() { $interface = I('get.interface'); if (!$interface) { $rt['status'] = 0; $rt['msg'] = '接口url缺失'; $this->ajaxReturn($rt); } else { self::$interface(); } } public function index2() { $interface = I('get.interface'); if (!$interface) { $rt['status'] = 0; $rt['msg'] = '接口url缺失'; $this->ajaxReturn($rt); } else { self::$interface(); } } public function xj() { self::cashPay(); } public function vip() { self::cardpay(); } public function wxzfb() { self::placeOrder(); } // 文件上传 public function uploadFile() { $merchant_id = I('post.merchant_id'); $store_id = I('post.store_id'); $item = array( 'add_time' => time(), 'from_type_id' => 28, 'localUrl' => 'Store/Goods', 'user_type' => 4, 'merchant_id' => $merchant_id, 'store_id' => $store_id ); $uploads = uploadFiles($item);//上传图片 if (!empty($uploads['file'])) { $path['status'] = 1; $path['goods_image_id'] = $uploads['file']['id']; //商品展示图片 $path['path'] = $uploads['file']['id']; //商品展示图片 } else { $path['status'] = 0; $path['path'] = '图片上传失败'; $path['status'] = 0; } $this->ajaxReturn($path); } /* public function getMyController(){ $m = I('get.m'); $m = $m?$m:I('post.m'); //根据thinkphp文件命名规则可以知道文件名和控制器的名称是一致的; //根据thinkphp目录结构可以知道控制器目录的路径; $controllers = $this->getControllers($_SERVER['DOCUMENT_ROOT']."/Application/{$m}/Controller"); //如果你的控制器目录不是tp的默认目录按照你项目的时间目录传递给getControllers函数 $this->ajaxReturn($controllers); } //获取某个目录下的php文件名的函数 protected function getControllers($dir) { $pathList = glob($dir . '/*.php'); $res = []; foreach($pathList as $key => $value) { $res[] = basename($value, 'Controller.class.php'); } return $res; } //获取某个控制器的方法名的函数 //此方法过滤父级Base控制器的方法,只保留自己的 protected function getActions($className,$basename="") { $methods = get_class_methods(A($className)); if($className!=$basename && $basename){ $baseMethods = get_class_methods(A($basename)); $res = array_diff($methods, $baseMethods); return $res; }else{ return $methods; } } public function getMyActions(){ $m = I('get.m'); $m = $m?$m:I('post.m'); $control = I('get.c'); $control = $control?$control:I('post.c'); //下面是获取Index控制中你定义的方法,在mobadmin的应用场景中$control由前端传入, //这样就能够达到我选择某个一个控制器的时候,就会输出这个控制中定义的方法。 $actions = $this->getActions($control); //系统中所有控制的方法怎么获取呢?遍历所有控制器就可以。 $controllers = $this->getControllers($_SERVER['DOCUMENT_ROOT']."/Application/{$m}/Controller"); $actionsAll = []; $b = I('get.b'); $b = $b?$b:I('post.b'); foreach( $controllers as $key=>$value) { if($b){ $actionsAll[$value] = $this->getActions($m.'/'.$value,$m.'/'.$b); }else{ $actionsAll[$value] = $this->getActions($m.'/'.$value); } } $rt['action'] = $actions; $rt['actionAll'] = $actionsAll; $this->ajaxReturn($rt); }*/ }