作者 lyh

gx

... ... @@ -114,8 +114,6 @@ zFePUMXy1bFghAfzNKlrc5XgH4ixeeMh3cDtU97K
*/
public function post_send_msg($param,$api_key){
//平台参数处理
// $this->headers['Accept-Encoding'] = 'gzip';
// $this->headers['Authorization'] = $this->headers['Authorization'].$api_key;
$param['idempotencyKey'] = uniqid().time();
$url = $this->path.'/api/post';
return $this->http_post_ayr($url,$param,$api_key);
... ...
... ... @@ -120,67 +120,60 @@ class ComController extends BaseController
$this->response('success');
}
// /**
// * @name :(测试接口)ceShi
// * @author :lyh
// * @method :post
// * @time :2023/5/19 10:03
// */
// public function ceShi(){
// $country = new Country();
// return $country->set_country();
// }
/**
* @name : 检测用户是否无操作记录
* @name : (测试定时任务)检测用户是否无操作记录
* @author :lyh
* @method :post
* @time :2023/5/12 14:55
*/
protected function ceShi(){
//获取所有ayr_share用户
$ayr_share_model = new AyrShareModel();
$ayr_share_list = $ayr_share_model->list();
foreach ($ayr_share_list as $k => $v){
//查询当前用户是否有未推送的博文
$ayr_release = new AyrReleaseModel();
$release_info = $ayr_release->read(['schedule_date'=>['>',date('Y-m-d H:i:s',time())],'share_id'=>$v['id']]);
//有推文时,直接跳出循环
if($release_info !== false){
continue;
}
//查看用户是否在一周内有发送博客
$start_at = Carbon::now()->modify('-7 days')->toDateString();
$end_at = Carbon::now()->toDateString();
$release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]);
//有发送博文,则跳出循环
if($release_info == false){
continue;
}
//删除用户第三方配置
$ayr_share_helper = new AyrShareHelper();
$data_profiles = [
'title'=>$v['title'],
'profileKey'=>$v['profile_key']
];
$res = $ayr_share_helper->deleted_profiles($data_profiles);
if($res['status'] == 'fail'){
$this->error++;
continue;
}
//更新数据库
$data = [
'title'=>null,
'bind_plat_from'=>null,
'profile_key'=>null,
'ref_id'=>null,
];
$res = $ayr_share_model->edit($data,['id'=>$v['id']]);
if($res == false){
$this->error++;
}
}
return $this->error;
}
// protected function ceShi(){
// $this->error = 0;
// //获取所有ayr_share用户
// $ayr_share_model = new AyrShareModel();
// $ayr_share_list = $ayr_share_model->list($this->map);
// if(!empty($ayr_share_list)){
// foreach ($ayr_share_list as $k => $v){
// //查询当前用户是否有未推送的博文
// $ayr_release = new AyrReleaseModel();
// $release_info = $ayr_release->read(['schedule_date'=>['>',date('Y-m-d H:i:s',time())],'share_id'=>$v['id']]);
// //有推文时,直接跳出循环
// if($release_info !== false){
// continue;
// }
// //查看用户是否在一周内有发送博客
// $start_at = Carbon::now()->modify('-7 days')->toDateString();
// $end_at = Carbon::now()->toDateString();
// $release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]);
// //有发送博文,则跳出循环
// if($release_info == false){
// continue;
// }
// //删除用户第三方配置
// $ayr_share_helper = new AyrShareHelper();
// $data_profiles = [
// 'title'=>$v['title'],
// 'profileKey'=>$v['profile_key']
// ];
// $res = $ayr_share_helper->deleted_profiles($data_profiles);
// if($res['status'] == 'fail'){
// $this->error++;
// continue;
// }
// //更新数据库
// $data = [
// 'title'=>null,
// 'bind_plat_from'=>null,
// 'profile_key'=>null,
// 'ref_id'=>null,
// ];
// $res = $ayr_share_model->edit($data,['id'=>$v['id']]);
// if($res == false){
// $this->error++;
// }
// }
// }
// return $this->error;
// }
}
... ...
... ... @@ -84,7 +84,7 @@ class Base extends Model
* @author :liyuhang
* @method
*/
public function list($map,$order = 'sort',$fields = ['*']): array
public function list($map = [],$order = 'id',$fields = ['*']): array
{
$query = $this->formatQuery($map);
$lists = $query->select($fields)->orderBy($order)->get();
... ...