| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\api\controller;
- use app\common\model\ApiUser;
- use app\common\model\Orders;
- use app\common\model\ShopList;
- use think\facade\Db;
- use think\Exception;
- use think\facade\Request;
- use think\Log;
- class Shops extends Base
- {
- // protected $noNeedLogin = [''];
- /**
- * @return void 全部平台
- */
- public function getPlatform(){
- $list = site_config('addonsd.platform_list');
- $this->success('提交成功', $list);
- }
- //获取店铺
- public function getShop(ShopList $shopList){
-
- $platform_id = $this->request->post('platform_id/d');
- if(empty($platform_id)){
- $this->error('参数有误');
- }
- return $this->success('ok', $shopList->where('platform', $platform_id)->column('name', 'id'));
- }
- //获取规格
- public function getSpec(ShopList $shopList){
- $shop_id = $this->request->post('shop_id/d');
- if( empty($shop_id)){
- $this->error('参数有误');
- }
-
- return $this->success('ok', json_decode($shopList->where('id', $shop_id)->value('type_spec'), true));
- }
- function doCurlPostRequest($url = '',Array $data = array())
- {
- $data_string = json_encode($data,JSON_UNESCAPED_UNICODE);
- // $data_string = $data;
- $curl_con = curl_init();
- curl_setopt($curl_con, CURLOPT_URL,$url);
- curl_setopt($curl_con, CURLOPT_HEADER, false);
- curl_setopt($curl_con, CURLOPT_POST, true);
- curl_setopt($curl_con, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($curl_con, CURLOPT_CONNECTTIMEOUT, 5);
- curl_setopt($curl_con, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($data_string))
- );
- curl_setopt($curl_con, CURLOPT_POSTFIELDS, $data_string);
- $res = curl_exec($curl_con);
- $status = curl_getinfo($curl_con);
- curl_close($curl_con);
- if (isset($status['http_code']) && $status['http_code'] == 200) {
- return $res;
- } else {
- return FALSE;
- }
- }
- }
|