|
@@ -2,45 +2,44 @@
|
|
|
|
|
|
|
|
namespace app\api\controller;
|
|
namespace app\api\controller;
|
|
|
|
|
|
|
|
-use lk\Lk;
|
|
|
|
|
-use think\facade\Log;
|
|
|
|
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
|
|
class Test
|
|
class Test
|
|
|
{
|
|
{
|
|
|
public function t1()
|
|
public function t1()
|
|
|
{
|
|
{
|
|
|
ajax_success();
|
|
ajax_success();
|
|
|
-// $url = "https://lw_test.jinjianghc.com/api/sms/send";
|
|
|
|
|
-// $token = "oYtEwqzL68be506f50a52";
|
|
|
|
|
- $url = "http://bd.lwtest.com/api/sms/send";
|
|
|
|
|
- $token = "7ec987cb2daf4c44a84ff1f145c51f2b";
|
|
|
|
|
- $postArr = ['mobile'=>'13313826760','type'=>'lk','template_code'=>'verification_code','template_param'=>['code'=>'123123']];
|
|
|
|
|
- $postFields = json_encode($postArr);
|
|
|
|
|
-
|
|
|
|
|
- $ch = curl_init();
|
|
|
|
|
- curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
|
|
- curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
|
|
|
- 'Content-Type: application/json; charset=utf-8', //json版本需要填写 Content-Type: application/json;
|
|
|
|
|
- 'token:'.$token,
|
|
|
|
|
- ]
|
|
|
|
|
- );
|
|
|
|
|
- curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); //若果报错 name lookup timed out 报错时添加这一行代码
|
|
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
|
|
|
- curl_setopt($ch, CURLOPT_POST, 1);
|
|
|
|
|
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
|
|
|
|
|
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
|
|
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
|
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
|
|
|
|
- $ret = curl_exec($ch);
|
|
|
|
|
- curl_close($ch);
|
|
|
|
|
- $rsp = json_decode($ret, true);
|
|
|
|
|
- halt($rsp);
|
|
|
|
|
- if ($rsp['code'] != 0) {
|
|
|
|
|
- Log::record('短信发送失败:' . json_encode($rsp) . "。原始参数:" . json_encode($postArr));
|
|
|
|
|
- return ['code' => 1, 'msg' => $rsp['errorMsg']];
|
|
|
|
|
- } else {
|
|
|
|
|
- return ['code' => 0];
|
|
|
|
|
|
|
+ $list = import_exl('1.xlsx',['name','sex','card_type','card_no','company','post','start_time','end_time','level','mobile'],1);
|
|
|
|
|
+ $level_list = [
|
|
|
|
|
+ '省特级' => '第一层次',
|
|
|
|
|
+ '省级A类' => '第一层次',
|
|
|
|
|
+ '省级B类' => '第二层次',
|
|
|
|
|
+ '省级C类' => '第三层次',
|
|
|
|
|
+ ];
|
|
|
|
|
+ foreach ($list as $k => $v) {
|
|
|
|
|
+// $time = explode(' - ',$v['start_time']);
|
|
|
|
|
+// $list[$k]['start_time'] = $time[0].' 00:00:00';
|
|
|
|
|
+// $list[$k]['end_time'] = $time[1].' 00:00:00';
|
|
|
|
|
+// $list[$k]['level'] = str_replace(['泉州','(自主认定)'],'',$v['level']);
|
|
|
|
|
+
|
|
|
|
|
+// $list[$k]['start_time'] = str_replace('.','-',$v['start_time']).' 00:00:00';
|
|
|
|
|
+// $end = (int) $v['end_time'];
|
|
|
|
|
+// if (empty($end)) {
|
|
|
|
|
+// $list[$k]['end_time'] = '2099-01-01 00:00:00';
|
|
|
|
|
+// } else {
|
|
|
|
|
+// $list[$k]['end_time'] = date('Y-m-d H:i:s',strtotime("+{$end} years",strtotime($list[$k]['start_time'])));
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// $list[$k]['level'] = $level_list[$v['level']];
|
|
|
|
|
+
|
|
|
|
|
+ $list[$k]['start_time'] = '2025-01-01 00:00:00';
|
|
|
|
|
+ $list[$k]['end_time'] = '2099-01-01 00:00:00';
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+// halt($list);
|
|
|
|
|
+
|
|
|
|
|
+ Db::name('talent')->insertAll($list);
|
|
|
|
|
+ ajax_success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|