|
@@ -1065,36 +1065,96 @@ class ApiController extends BaseController
|
|
|
|
|
|
//微信公众号获取文章列表
|
|
|
public function getWechatArticleList(){
|
|
|
- $access_token = $this->getaccessToken();
|
|
|
+ $res = $this->getaccessToken();
|
|
|
+ // dd($res);
|
|
|
+ if($res['access_token']){
|
|
|
+ // 获取已发布但未群发的文章
|
|
|
+ $access_token = $res['access_token'];
|
|
|
+ $url = 'https://api.weixin.qq.com/cgi-bin/freepublish/batchget?access_token='.$access_token;
|
|
|
+ $params = [
|
|
|
+ "offset" => 0,
|
|
|
+ "no_content" => 1,
|
|
|
+ "count" => 10
|
|
|
+ ];
|
|
|
+ $result = $this->httpRequest($url,'post',$params);
|
|
|
+ return $result;
|
|
|
|
|
|
- $url = 'https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token='.$access_token;
|
|
|
|
|
|
- $params = [
|
|
|
- "type" => "news",
|
|
|
- "offset" => 0,
|
|
|
- "count" => 10
|
|
|
- ];
|
|
|
|
|
|
- $result = $this->httpRequest($url,'POST',$params);
|
|
|
+ // 获取永久图文素材(已群发)
|
|
|
+ // $access_token = $res['access_token'];
|
|
|
+ // $url = 'https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token='.$access_token;
|
|
|
+ // $params = [
|
|
|
+ // "type" => 'news',
|
|
|
+ // "offset" => 0,
|
|
|
+ // "count" => 20
|
|
|
+ // ];
|
|
|
+ // $result = $this->httpRequest($url,'post',$params);
|
|
|
+ // return $result;
|
|
|
|
|
|
- return $result;
|
|
|
+
|
|
|
+
|
|
|
+ // 获取草稿列表
|
|
|
+ // $access_token = $res['access_token'];
|
|
|
+ // $url = 'https://api.weixin.qq.com/cgi-bin/draft/batchget?access_token='.$access_token;
|
|
|
+ // $params = [
|
|
|
+ // "offset" => 0,
|
|
|
+ // "no_content" => 1,
|
|
|
+ // "count" => 200
|
|
|
+ // ];
|
|
|
+ // $result = $this->httpRequest($url,'post',$params);
|
|
|
+ // return $result;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//微信公众号获取access_token
|
|
|
public function getaccessToken(){
|
|
|
- $url = 'https://api.weixin.qq.com/cgi-bin/token';
|
|
|
-
|
|
|
- $params = [
|
|
|
- 'grant_type' => 'client_credential',
|
|
|
- 'appid' => env('WECHAT_KEY'),
|
|
|
- 'secret' => env('WECHAT_SECRET')
|
|
|
- ];
|
|
|
+ $url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='.env('MZY_WECHAT_APPID').'&secret='.env('MZY_WECHAT_APPSECRET');
|
|
|
|
|
|
- $result = $this->httpRequest($url,'GET',$params);
|
|
|
+ $result = $this->httpRequest($url,'GET',[]);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
+ //公管公司值班日历
|
|
|
+ public function dutyCalendar(){
|
|
|
+ $result['status'] = true;
|
|
|
+ $result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
|
+
|
|
|
+ $riqi = Input::get('riqi', '');
|
|
|
+
|
|
|
+ if (!$riqi) {
|
|
|
+ return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
|
+ }
|
|
|
+
|
|
|
+ $list = DB::connection('mysql_fwe10')->table('uf_gggs_zbgl')->get();
|
|
|
+ dd($list);
|
|
|
+
|
|
|
+ return self::successResponse($result);
|
|
|
+ }
|
|
|
+
|
|
|
+ //公管公司值班查询
|
|
|
+ public function dutySearch(){
|
|
|
+ $result['status'] = true;
|
|
|
+ $result['msg'] = ApiEnum::RETURN_SUCCESS;
|
|
|
+
|
|
|
+ $name = Input::get('name', '');
|
|
|
+ $start_date = Input::get('start_date', '');
|
|
|
+ $end_date = Input::get('end_date', '');
|
|
|
+
|
|
|
+ if (!$name) {
|
|
|
+ return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
|
+ }
|
|
|
+ if (!$start_date) {
|
|
|
+ return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
|
+ }
|
|
|
+ if (!$end_date) {
|
|
|
+ return self::errorResponse(ApiEnum::STATUS_CODE_EMPTY);
|
|
|
+ }
|
|
|
+
|
|
|
+ return self::successResponse($result);
|
|
|
+ }
|
|
|
+
|
|
|
//腾讯位置接口服务
|
|
|
public function sendRequest($url, $params) {
|
|
|
$ch = curl_init();
|