This commit is contained in:
dengbw
2022-06-02 17:22:48 +08:00
committed by xiaoyu
parent bf48bfb8a5
commit 18d74a7286
+52
View File
@@ -16,6 +16,58 @@ class Temp extends HD_Controller
$this->log_file = 'temp.log';
}
/**
* Notes:更新企微好友
* Created on: 2022/5/27 11:58
* Created by: dengbw
* https://liche-api-dev.xiaoyu.com/plan/temp/customers_wxqy
* https://api.liche.cn/plan/temp/customers_wxqy
*/
public function customers_wxqy()
{
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$this->load->model('app/licheb/App_licheb_users_model', 'mdUsers');
$this->load->model('app/app_lichene_qy_model', 'mdWechatqy');
$param = $this->input->get();
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 100;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
$where = ["status" => 1];
$res = $this->mdWechatqy->select($where, 'id ASC', $param['page'], $param['size'], 'userid,mobile');
if (!$res) {
echo '<br>本次更新完成了:';
echo '<br><br>成功更新 <span style="color: red;">' . $counts . '</span> 条';
echo '<br><br><a href="/plan/temp/customers_wxqy">点击将再次更新>>></a>';
exit;
}
$log = array();
foreach ($res as $key => $value) {
if ($value['userid'] && $value['mobile']) {
$mobile = $value['mobile'];
$re_use = $this->mdUsers->get(array('userid' => $value['userid']));
$biz_id = $re_use && $re_use['biz_id'] ? intval($re_use['biz_id']) : 0;
if ($biz_id) {
$where_cust = ['biz_id' => $biz_id, 'mobile' => $mobile, 'wxqy' => 0];
$re_cust = $this->mdCustomers->get($where_cust);
if ($re_cust) {
$this->mdCustomers->update(['wxqy' => 1], $where_cust);
$log[] = ['mobile' => $value['mobile'], 'biz_id' => $biz_id];
$counts++;
}
}
}
}
echo '<br>成功更新:';
$log && print_r($log);
echo '<br><br>数据库获取:';
echo json_encode($res, JSON_UNESCAPED_UNICODE);
//header('refresh:3;url=/plan/temp/customers_wxqy?counts=' . $counts . '&size=' . $param['size'] . '&page=' . ($param['page'] + 1));
ob_end_flush();//输出全部内容到浏览器
}
/**
* Notes:更新下架门店人员
* Created on: 2022/5/27 11:58