|
@@ -995,16 +995,31 @@ class LivingAllowance extends AdminController {
|
|
|
|
|
|
//查询需要公示的数据(勾选)
|
|
|
$request = $this->request;
|
|
|
+ $typeName = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "typeName")));
|
|
|
+ $address = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "address")));
|
|
|
+ $publicStartTime = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "publicStartTime")));
|
|
|
+ $publicEndTime = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "publicEndTime")));
|
|
|
+ $dep = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "dep")));
|
|
|
+ $phone = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "phone")));
|
|
|
+ $email = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "email")));
|
|
|
+
|
|
|
+ $tpl_content = sprintf("【晋江市人才服务平台】您好!您提交申请的%s已完成初步审核,现通过%s将审核结果予以公示,公示时间%s至%s。公示期间如有异议,请及时向%s反映。电话%s,电子邮箱%s。",
|
|
|
+ $typeName, $address, $publicStartTime, $publicEndTime, $dep, $phone, $sms); //短信内容
|
|
|
+
|
|
|
$batch = \StrUtil::getRequestDecodeParam($request, "batch");
|
|
|
$ids = array_filter(explode(",", \StrUtil::getRequestDecodeParam($request, "ids")));
|
|
|
$where = [];
|
|
|
$where[] = ["id", "in", $ids];
|
|
|
$list = LaModel::where($where)->select()->toArray();
|
|
|
- $recordList = [];
|
|
|
- $sb = [];
|
|
|
+
|
|
|
+ if ($isMessage == 1 && count($list) > 1000) {
|
|
|
+ $response->msg = "需要发送短信时公示量不能超过1000个";
|
|
|
+ return json($response);
|
|
|
+ }
|
|
|
+
|
|
|
$newLogs = [];
|
|
|
- //MessageRecord sendRecord = new MessageRecord(null, 2, 2, null, null, null, SmsProperties . CHECK_PUBLIC);
|
|
|
- //sendRecord . setId(IdWorker . getIdStr());
|
|
|
+ $recordList = [];
|
|
|
+ $phones = [];
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
for ($i = 0; $i < count($list); $i++) {
|
|
@@ -1024,42 +1039,37 @@ class LivingAllowance extends AdminController {
|
|
|
$newLog["createUser"] = sprintf("%s(%s)", $this->user["account"], $this->user["companyName"]);
|
|
|
|
|
|
$newLogs[] = $newLog;
|
|
|
- //sb . append(obj . getPhone() + "," + typeName + "," + address + "," + publicStartTime + "," + publicEndTime + "," + dep + "," + phone + "," + email + ";");
|
|
|
- /* * 短信参数 */
|
|
|
- //String param = obj . getPhone() + "," + typeName + "," + address + "," + publicStartTime + "," + publicEndTime + "," + dep + "," + phone + "," + email + ";";
|
|
|
- //sb . append(param);
|
|
|
- //MessageRecord record = new MessageRecord(null, 2, 2, obj . getName(), obj . getPhone(), param . substring(0, param . length() - 1), SmsProperties . CHECK_PUBLIC);
|
|
|
- //record . setState(1);
|
|
|
- //record . setBizId(sendRecord . getId());
|
|
|
- //record . setSendingDate(DateUtil . getTime());
|
|
|
- //record . setCreateTime(DateUtil . getTime());
|
|
|
- //recordList . add(record);
|
|
|
+
|
|
|
+ $phones[] = $obj["phone"];
|
|
|
+
|
|
|
+ $record = [
|
|
|
+ 'id' => getStringId(),
|
|
|
+ 'bizId' => getStringId(),
|
|
|
+ 'userId' => $obj["enterpriseId"],
|
|
|
+ 'type' => 2,
|
|
|
+ 'smsType' => 2,
|
|
|
+ 'phone' => $obj["phone"],
|
|
|
+ 'name' => $obj["enterpriseName"],
|
|
|
+ 'params' => '公示',
|
|
|
+ 'templateCode' => $tpl_content,
|
|
|
+ 'state' => 3,
|
|
|
+ 'sendingDate' => date("Y-m-d H:i:s", time()),
|
|
|
+ 'createTime' => date("Y-m-d H:i:s", time())
|
|
|
+ ];
|
|
|
+
|
|
|
+ $recordList[] = $record;
|
|
|
}
|
|
|
- /* if (isMessage != null && isMessage == 1) {
|
|
|
- if (list.size() > 1000) {
|
|
|
- return new ResponseObj(ResponseObj . FAILD, "需要发送短信时公示量不能超过1000个");
|
|
|
- }
|
|
|
- //发送短信
|
|
|
- Map map = new HashMap();
|
|
|
- map . put("account", smsProperties . getAccount());
|
|
|
- map . put("password", smsProperties . getPassword());
|
|
|
- map . put("msg", sendRecord . getTemplateCode());
|
|
|
- map . put("params", sb . substring(0, sb . length() - 1));
|
|
|
- map . put("report", "true");
|
|
|
- map . put("uid", sendRecord . getId());
|
|
|
- String sendUrl = smsProperties . getBaseUrl() + "variable/json";
|
|
|
- JSONObject js = (JSONObject) JSONObject . toJSON(map);
|
|
|
- String res = HttpUtil . sendSmsByPost(sendUrl, js . toString());
|
|
|
- JSONObject jsonObject = JSONObject . parseObject(res);
|
|
|
- String code = jsonObject . getString("code");
|
|
|
- String errorMsg = jsonObject . getString("errorMsg");
|
|
|
- if (!"0" . equals(code)) {
|
|
|
- return new ResponseObj(ResponseObj . FAILD, "短信发送失败,原因为:" + errorMsg);
|
|
|
- }
|
|
|
- this . messageRecordService . insertBatch(recordList);
|
|
|
- } */
|
|
|
+
|
|
|
+ Db::table("new_message_record")->insertAll($recordList);
|
|
|
Db::table("new_talent_checklog")->insertAll($newLogs);
|
|
|
Db::commit();
|
|
|
+
|
|
|
+ if ($isMessage == 1 && $phones) {
|
|
|
+ //批量发送短信
|
|
|
+ $sms = new ChuanglanSmsApi();
|
|
|
+ $result = $sms->sendSMS($phones, $tpl_content, true);
|
|
|
+ $result = json_decode($result, true);
|
|
|
+ }
|
|
|
$response->msg = "公示成功";
|
|
|
$response->code = 200;
|
|
|
return json($response);
|