adminAction.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <?php
  2. require_once(ONU_ROOT . 'application/lib/data/Base.class.php');
  3. class AdvertAdminAction extends BaseAction{
  4. //添加用户
  5. public function addUser($uname,$pwd){
  6. $sql = "insert into ly_user(uname,pwd) values('{$uname}','{$pwd}')";
  7. $result = $this->getDbEntity()->insert_sql($sql);
  8. return $result;
  9. }
  10. //登录
  11. public function selectUser($uname,$pwd){
  12. $sql = "select * from ly_user where uname='$uname' and pwd='$pwd' limit 1";
  13. $result = $this->getDbEntity()->query($sql);
  14. return $result[0];
  15. }
  16. //查询用户,通过uname
  17. public function selectUserByName($uname){
  18. $sql = "select * from ly_user where uname='$uname' limit 1";
  19. $result = $this->getDbEntity()->query($sql);
  20. return $result[0];
  21. }
  22. //查询所有用户
  23. public function selectAllUser(){
  24. $sql = "select * from ly_user ";
  25. $result = $this->getDbEntity()->query($sql);
  26. return $result;
  27. }
  28. //查询属于部门领导的用户
  29. public function selectHeaderUser(){
  30. $sql = "select id,uname from ly_user where role=2";
  31. $result = $this->getDbEntity()->query($sql);
  32. return $result;
  33. }
  34. //修改用户密码
  35. public function updateUserPwd($uname,$pwd){
  36. $sql = "update ly_user set pwd='{$pwd}' where uname='{$uname}'";
  37. $result = $this->getDbEntity()->execute_sql($sql);
  38. return $result;
  39. }
  40. //修改用户权限
  41. public function updateUserPersission($uname,$persission){
  42. $sql = "update ly_user set permission='{$persission}' where uname='{$uname}'";
  43. $result = $this->getDbEntity()->execute_sql($sql);
  44. return $result;
  45. }
  46. //修改用户角色及直属领导
  47. public function updateUserRole($data){
  48. $sql = "update ly_user set role='{$data['role']}',header_uid='{$data['header_uid']}' where uname='{$data['uname']}'";
  49. $result = $this->getDbEntity()->execute_sql($sql);
  50. return $result;
  51. }
  52. //删除用户
  53. public function deleteUser($uname){
  54. $sql = "delete from ly_user where uname='{$uname}'";
  55. $result = $this->getDbEntity()->query($sql);
  56. return $result;
  57. }
  58. //查询所有的图片
  59. public function selectAllImages(){
  60. $sql = "select * from ly_smt_images ";
  61. $result = $this->getDbEntity()->query($sql);
  62. return $result;
  63. }
  64. //导入客户,添加客户信息
  65. public function add_customer($data){
  66. $sql = "insert into ly_customer(email,uname,country,city,tel,uid,add_time,group_name) values
  67. ('{$data['email']}','{$data['uname']}','{$data['country']}','{$data['city']}','{$data['tel']}','{$data['uid']}','{$data['add_time']}','{$data['group_name']}')";
  68. $result = $this->getDbEntity()->insert_sql($sql);
  69. return $result;
  70. }
  71. public function add_sms_customer($data){
  72. $sql = "replace into ly_sms_customer(uname, country, tel, uid, group_name) values
  73. ('{$data['uname']}','{$data['country']}','{$data['tel']}','{$data['uid']}','{$data['group_name']}')";
  74. $result = $this->getDbEntity()->insert_sql($sql);
  75. return $result;
  76. }
  77. public function import_sms_customer($values){
  78. $sql = "replace into ly_sms_customer(uname, country, tel, uid, group_name, is_block) values" . $values;
  79. $result = $this->getDbEntity()->insert_sql($sql);
  80. return $result;
  81. }
  82. //导入客户,批量添加客户信息
  83. public function addpl_customer($data){
  84. $sql = "replace into ly_customer(email,uname,country,city,tel,uid,add_time,group_name) values ";
  85. foreach ($data as $k => $v) {
  86. $sql .= "(\"{$v['email']}\",\"{$v['uname']}\",\"{$v['country']}\",\"{$v['city']}\",\"{$v['tel']}\",\"{$v['uid']}\",\"{$v['add_time']}\",\"{$v['group_name']}\"),";
  87. }
  88. $sql = substr($sql,0,-1);
  89. $sql .= ";";
  90. $result = $this->getDbEntity()->insert_sql($sql);
  91. return $result;
  92. }
  93. //导入黑名单,添加黑名单信息
  94. public function add_blacklist($data){
  95. $sql = "insert into ly_blacklist(email,uid,add_time) values
  96. ('{$data['email']}','{$data['uid']}','{$data['add_time']}')";
  97. $result = $this->getDbEntity()->insert_sql($sql);
  98. return $result;
  99. }
  100. public function selectCustomerCount($where){
  101. $sql = "select count(*) as count from ly_customer $where ";
  102. $result = $this->getDbEntity()->query($sql);
  103. return $result[0]['count'];
  104. }
  105. public function selectSmsCustomerCount($where){
  106. $sql = "select count(*) as count from ly_sms_customer $where ";
  107. $result = $this->getDbEntity()->query($sql);
  108. return $result[0]['count'];
  109. }
  110. public function selectBlacklistCount($where){
  111. $sql = "select count(*) as count from ly_blacklist $where ";
  112. $result = $this->getDbEntity()->query($sql);
  113. return $result[0]['count'];
  114. }
  115. //查询所有客户
  116. public function selesctCustomer($where,$limit){
  117. if(!empty($limit)){
  118. $sql = "select * from ly_customer $where order by id desc limit $limit ";
  119. }else{
  120. $sql = "select * from ly_customer $where order by id desc ";
  121. }
  122. $result = $this->getDbEntity()->query($sql);
  123. return $result;
  124. }
  125. public function selesctSmsCustomer($where,$limit=0){
  126. if(!empty($limit)){
  127. $sql = "select * from ly_sms_customer $where order by id desc limit $limit ";
  128. }else{
  129. $sql = "select * from ly_sms_customer $where order by id desc ";
  130. }
  131. $result = $this->getDbEntity()->query($sql);
  132. return $result;
  133. }
  134. public function selectSmsBlackList($uid) {
  135. $sql = "select tel from ly_sms_customer where is_block=1 and uid=$uid order by id desc ";
  136. $result = $this->getDbEntity()->query($sql);
  137. return $result;
  138. }
  139. //查询UID下所有客户Email
  140. public function selesctCustomerByUid($uid){
  141. $sql = "select email from ly_customer where 1=1 and uid = $uid ";
  142. $result = $this->getDbEntity()->query($sql);
  143. return $result;
  144. }
  145. //查询所有黑名单
  146. public function selesctBlacklist($where,$limit){
  147. if(!empty($limit)){
  148. $sql = "select * from ly_blacklist $where order by id desc limit $limit ";
  149. }else{
  150. $sql = "select * from ly_blacklist $where order by id desc ";
  151. }
  152. $result = $this->getDbEntity()->query($sql);
  153. return $result;
  154. }
  155. public function selectAllBlack($uid){
  156. $sql = "select email from ly_blacklist where uid=$uid";
  157. $result = $this->getDbEntity()->query($sql);
  158. return $result;
  159. }
  160. //查询客户信息
  161. public function selectOneCustomer($id){
  162. $sql = "select * from ly_customer where id='$id' ";
  163. $result = $this->getDbEntity()->query($sql);
  164. return $result[0];
  165. }
  166. public function selectOneSmsCustomer($id){
  167. $sql = "select * from ly_sms_customer where id='$id' ";
  168. $result = $this->getDbEntity()->query($sql);
  169. return $result[0];
  170. }
  171. //查询黑名单信息
  172. public function selectOneBlack($id){
  173. $sql = "select * from ly_blacklist where id='$id' ";
  174. $result = $this->getDbEntity()->query($sql);
  175. return $result[0];
  176. }
  177. //根据邮箱查询客户信息
  178. public function selectCustomerByEmail($email,$uid){
  179. $sql = "select * from ly_customer where email='$email' and uid='$uid' ";
  180. $result = $this->getDbEntity()->query($sql);
  181. return $result[0];
  182. }
  183. public function selectCustomerByTel($tel, $uid){
  184. $sql = "select * from ly_sms_customer where tel='$tel' and uid='$uid' ";
  185. $result = $this->getDbEntity()->query($sql);
  186. return $result[0];
  187. }
  188. //根据邮箱查询H黑名单信息
  189. public function selectBlackByEmail($email,$uid){
  190. $sql = "select * from ly_blacklist where email='$email' and uid='$uid' ";
  191. $result = $this->getDbEntity()->query($sql);
  192. return $result[0];
  193. }
  194. //编辑客户信息
  195. public function updateCustomer($data,$id){
  196. $sql = "update ly_customer set email='{$data['email']}',uname='{$data['uname']}',group_name='{$data['group_name']}',
  197. country = '{$data['country']}',city = '{$data['city']}',tel='{$data['tel']}'
  198. where id='$id'";
  199. $result = $this->getDbEntity()->execute_sql($sql);
  200. return $result;
  201. }
  202. public function updateSmsCustomer($data,$id){
  203. $sql = "update ly_sms_customer set uname='{$data['uname']}',group_name='{$data['group_name']}',
  204. country = '{$data['country']}',tel='{$data['tel']}'
  205. where id='$id'";
  206. $result = $this->getDbEntity()->execute_sql($sql);
  207. return $result;
  208. }
  209. //编辑黑名单信息
  210. public function updateBlack($data,$id){
  211. $sql = "update ly_blacklist set email='{$data['email']}'
  212. where id='$id'";
  213. $result = $this->getDbEntity()->execute_sql($sql);
  214. return $result;
  215. }
  216. //编辑客户信息
  217. public function updateCustomerByEmail($data){
  218. $sql = "update ly_customer set uname='{$data['uname']}',group_name='{$data['group_name']}',
  219. country = '{$data['country']}',city = '{$data['city']}',tel='{$data['tel']}'
  220. where uid='{$data['uid']}' and email='{$data['email']}'";
  221. $result = $this->getDbEntity()->execute_sql($sql);
  222. return $result;
  223. }
  224. //批量更新客户用户组信息
  225. public function updateCustomerGroupByEmail($data){
  226. $sql = "insert into ly_im_data_tmp (sql_content) values ";
  227. foreach ($data as $k => $v) {
  228. $sql_content['tabname'] = "ly_customer";
  229. $sql_content['exc'] = " update";
  230. $sql_content['data'] = $v;
  231. $sql .= "('".addslashes(serialize($sql_content))."'),";
  232. }
  233. $sql = substr($sql,0,-1);
  234. $sql .= ";";
  235. $result = $this->getDbEntity()->execute_sql($sql);
  236. return $result;
  237. }
  238. //删除客户信息
  239. public function deleteCustomer($id,$uid){
  240. $sql = "delete from ly_customer where id='$id' and uid='$uid' ";
  241. $result = $this->getDbEntity()->query($sql);
  242. return $result;
  243. }
  244. public function deleteSmsCustomer($id, $uid){
  245. $sql = "delete from ly_sms_customer where id='$id' and uid='$uid' ";
  246. $result = $this->getDbEntity()->query($sql);
  247. return $result;
  248. }
  249. public function deleteSmsCustomerByExcel($telsStr, $uid){
  250. $sql = "delete from ly_sms_customer where tel in ($telsStr) and uid='$uid' ";
  251. $result = $this->getDbEntity()->query($sql);
  252. return $result;
  253. }
  254. //删除黑名单
  255. public function deleteBlack($id,$uid){
  256. $sql = "delete from ly_blacklist where id='$id' and uid='$uid' ";
  257. $result = $this->getDbEntity()->query($sql);
  258. return $result;
  259. }
  260. //按客户分组删除客户信息
  261. public function deleteCustomerByGroup($group_name,$uid){
  262. $sql = "delete from ly_customer where group_name='$group_name' and uid='$uid' ";
  263. $result = $this->getDbEntity()->query($sql);
  264. return $result;
  265. }
  266. public function deleteSmsCustomerByGroup($group_name, $uid){
  267. $sql = "delete from ly_sms_customer where group_name='$group_name' and uid='$uid' ";
  268. $result = $this->getDbEntity()->query($sql);
  269. return $result;
  270. }
  271. //删除多个分组的客户信息
  272. public function deleteBatchCus($group_name,$uid){
  273. $sql = "delete from ly_customer where group_name in ($group_name) and uid='$uid' ";
  274. $result = $this->getDbEntity()->query($sql);
  275. return $result;
  276. }
  277. //批量删除客户信息
  278. public function deleteBatchCustomer($id_array,$uid){
  279. $sql = "delete from ly_customer where id in ($id_array) and uid='$uid' ";
  280. $result = $this->getDbEntity()->query($sql);
  281. return $result;
  282. }
  283. public function deleteBatchSmsCustomer($id_array, $uid){
  284. $sql = "delete from ly_sms_customer where id in ($id_array) and uid='$uid' ";
  285. $result = $this->getDbEntity()->query($sql);
  286. return $result;
  287. }
  288. //批量删除黑名单
  289. public function deleteBatchBlack($id_array,$uid){
  290. $sql = "delete from ly_blacklist where id in ($id_array) and uid='$uid' ";
  291. $result = $this->getDbEntity()->query($sql);
  292. return $result;
  293. }
  294. //批量删除用户分组
  295. public function deleteBatchUserGroup($id_array,$uid){
  296. $sql = "delete from ly_user_group where id in ($id_array) and uid='$uid' ";
  297. $result = $this->getDbEntity()->query($sql);
  298. return $result;
  299. }
  300. public function deleteBatchSmsUserGroup($id_array,$uid){
  301. $sql = "delete from ly_sms_user_group where id in ($id_array) and uid='$uid' ";
  302. $result = $this->getDbEntity()->query($sql);
  303. return $result;
  304. }
  305. //普通发送插入日志表 普通邮件发送日志表
  306. public function inserEmail1Log($data){
  307. $sql = "insert into ly_send_email1_log(to_user,subject,content,replay_to,`time`,message,uid) values
  308. ('{$data['to']}','{$data['subject']}','{$data['html']}','{$data['replyto']}','{$data['time']}','{$data['message']}','{$data['uid']}')";
  309. $result = $this->getDbEntity()->insert_sql($sql);
  310. return $result;
  311. }
  312. public function deleteBatchCustomerByEmail($id_array,$uid){
  313. $sql = "delete from ly_customer where email in ($id_array) and uid='$uid' ";
  314. $result = $this->getDbEntity()->query($sql);
  315. return $result;
  316. }
  317. //邮件模板列表
  318. public function select_msg_list($where,$limit){
  319. if(!empty($limit)){
  320. $sql = "select * from ly_email_template $where order by status asc,id desc limit $limit";
  321. }else{
  322. $sql = "select * from ly_email_template $where order by status asc,id desc";
  323. }
  324. $result = $this->getDbEntity()->query($sql);
  325. return $result;
  326. }
  327. //短信模板列表
  328. public function select_smstm_list($where,$limit=0){
  329. if(!empty($limit)){
  330. $sql = "select * from ly_sms_template $where order by status asc,id desc limit $limit";
  331. }else{
  332. $sql = "select * from ly_sms_template $where order by status asc,id desc";
  333. }
  334. $result = $this->getDbEntity()->query($sql);
  335. return $result;
  336. }
  337. //查询邮件模板数量
  338. public function select_msg_count($where){
  339. $sql = "select count(*) as count from ly_email_template $where ";
  340. $result = $this->getDbEntity()->query($sql);
  341. return $result[0]['count'];
  342. }
  343. //查询短信模板数量
  344. public function select_smstm_count($where){
  345. $sql = "select count(*) as count from ly_sms_template $where ";
  346. $result = $this->getDbEntity()->query($sql);
  347. return $result[0]['count'];
  348. }
  349. //添加邮件模板
  350. public function add_email_msg($data){
  351. $sql = "insert into ly_email_template(msg_title,msg_content,status,add_time,`update_time`,uid,`type`) values
  352. ('{$data['msg_title']}','{$data['msg_content']}','{$data['status']}','{$data['add_time']}','{$data['update_time']}','{$data['uid']}','{$data['type']}')";
  353. $result = $this->getDbEntity()->insert_sql($sql);
  354. return $result;
  355. }
  356. //添加短信模板
  357. public function add_smstm_msg($data){
  358. $sql = "insert into ly_sms_template(msg_title,msg_content,status,add_time,`update_time`,uid,`type`) values
  359. ('{$data['msg_title']}','{$data['msg_content']}','{$data['status']}','{$data['add_time']}','{$data['update_time']}','{$data['uid']}','{$data['type']}')";
  360. $result = $this->getDbEntity()->insert_sql($sql);
  361. return $result;
  362. }
  363. //查询某一个邮件模板
  364. public function select_one_template($id){
  365. $sql = "select * from ly_email_template where id='$id' ";
  366. $result = $this->getDbEntity()->query($sql);
  367. return $result[0];
  368. }
  369. //查询某一个短信模板
  370. public function select_onesms_template($id){
  371. $sql = "select * from ly_sms_template where id='$id' ";
  372. $result = $this->getDbEntity()->query($sql);
  373. return $result[0];
  374. }
  375. //修改邮件模板
  376. public function update_email_msg($data,$id,$uid){
  377. $sql = "update ly_email_template set msg_title='{$data['msg_title']}',msg_content='{$data['msg_content']}',
  378. status = '{$data['status']}',update_time = '{$data['update_time']}'
  379. where id='$id' and uid='$uid'";
  380. $result = $this->getDbEntity()->execute_sql($sql);
  381. return $result;
  382. }
  383. //修改短信模板
  384. public function update_smstm_msg($data,$id,$uid){
  385. $sql = "update ly_sms_template set msg_title='{$data['msg_title']}',msg_content='{$data['msg_content']}',
  386. status = '{$data['status']}',update_time = '{$data['update_time']}'
  387. where id='$id' and uid='$uid'";
  388. $result = $this->getDbEntity()->execute_sql($sql);
  389. return $result;
  390. }
  391. //禁用邮件模板
  392. public function deleteEmailTemplate($status,$id,$uid){
  393. $sql = "update ly_email_template set status='{$status}'
  394. where id='$id' and uid='$uid'";
  395. $result = $this->getDbEntity()->execute_sql($sql);
  396. return $result;
  397. }
  398. //禁用短信模板
  399. public function deleteSmsTemplate($status,$id,$uid){
  400. $sql = "update ly_sms_template set status='{$status}'
  401. where id='$id' and uid='$uid'";
  402. $result = $this->getDbEntity()->execute_sql($sql);
  403. return $result;
  404. }
  405. //查询所有用户分组
  406. public function select_user_group($where){
  407. $sql = "select * from ly_user_group $where order by id desc";
  408. $result = $this->getDbEntity()->query($sql);
  409. return $result;
  410. }
  411. //查询所有用户分组
  412. public function select_sms_user_group($where){
  413. $sql = "select * from ly_sms_user_group $where order by id desc";
  414. $result = $this->getDbEntity()->query($sql);
  415. return $result;
  416. }
  417. //添加用户分组
  418. public function add_user_group($data){
  419. $sql = "insert into ly_user_group(uid,`name`,add_time,update_time)
  420. values('{$data['uid']}','{$data['name']}','{$data['add_time']}','{$data['update_time']}')";
  421. $result = $this->getDbEntity()->insert_sql($sql);
  422. return $result;
  423. }
  424. public function add_sms_user_group($data){
  425. $sql = "insert into ly_sms_user_group(uid,`name`)
  426. values('{$data['uid']}','{$data['name']}')";
  427. $result = $this->getDbEntity()->insert_sql($sql);
  428. return $result;
  429. }
  430. //查询某个用户分组
  431. public function select_one_user_group($id,$uid){
  432. $sql = "select * from ly_user_group where id='$id' and uid='$uid'";
  433. $result = $this->getDbEntity()->query($sql);
  434. return $result[0];
  435. }
  436. //查询多个用户分组
  437. public function select_batch_user_group($in_array,$uid){
  438. $sql = "select * from ly_user_group where id in ($in_array) and uid='$uid'";
  439. $result = $this->getDbEntity()->query($sql);
  440. return $result;
  441. }
  442. //判断客户分组
  443. public function select_group_byName($group_name,$uid){
  444. $sql = "select * from ly_user_group where name='$group_name' and uid='$uid'";
  445. $result = $this->getDbEntity()->query($sql);
  446. return $result[0];
  447. }
  448. public function select_usergroup_byName($group_name,$uid){
  449. $sql = "select * from ly_sms_user_group where name='$group_name' and uid='$uid'";
  450. $result = $this->getDbEntity()->query($sql);
  451. return $result[0];
  452. }
  453. //修改用户分组
  454. public function update_user_group($data, $id,$uid){
  455. $sql = "update ly_user_group set
  456. `name` = '{$data['name']}',
  457. update_time = '{$data['update_time']}'
  458. where id='{$id}' and uid='$uid'";
  459. $result = $this->getDbEntity()->execute_sql($sql);
  460. return $result;
  461. }
  462. //查询分组用户的数量
  463. public function select_usergroup_count($where){
  464. $sql = "select count(*) as count from ly_customer $where";
  465. $result = $this->getDbEntity()->query($sql);
  466. return $result[0];
  467. }
  468. //查询用户分组里的所有用户
  469. public function select_usergroup_info($where,$limit){
  470. if(!empty($limit)){
  471. $sql = "select * from ly_customer $where order by add_time desc limit $limit";
  472. }else{
  473. $sql = "select * from ly_customer $where order by add_time desc";
  474. }
  475. $result = $this->getDbEntity()->query($sql);
  476. return $result;
  477. }
  478. //删除用户分组
  479. public function deleteUserGroupMsg($where){
  480. $sql = " delete from ly_user_group where $where";
  481. $result = $this->getDbEntity()->query($sql);
  482. return $result;
  483. }
  484. public function deleteSmsUserGroupMsg($where){
  485. $sql = " delete from ly_sms_user_group where $where";
  486. $result = $this->getDbEntity()->query($sql);
  487. return $result;
  488. }
  489. //查询退信用户是否存在
  490. public function select_ndr_user($where,$email){
  491. $sql = " select email from ly_ndr_user where $where and email='$email'";
  492. $result = $this->getDbEntity()->query($sql);
  493. return $result;
  494. }
  495. //查询所有退信用户
  496. public function selectAllNdrUser($uid){
  497. $sql = "select email from ly_ndr_user where uid=$uid";
  498. $result = $this->getDbEntity()->query($sql);
  499. return $result;
  500. }
  501. //插入退信用户
  502. public function insert_ndr_user($data){
  503. $sql = "insert into ly_ndr_user(uid,email)
  504. values('{$data['uid']}','{$data['email']}')";
  505. $result = $this->getDbEntity()->insert_sql($sql);
  506. return $result;
  507. }
  508. //查询临时表数据
  509. public function select_tmp_data(){
  510. $sql = " select id from ly_im_data_tmp ";
  511. $result = $this->getDbEntity()->query($sql);
  512. return $result;
  513. }
  514. //插入待发送邮件参数数据
  515. public function add_email_data_queue($data){
  516. $sql = 'INSERT INTO `ly_email_data_tmp` (`params_json`) VALUES ';
  517. $params_json = '';
  518. foreach($data as $value){
  519. $params_json = serialize($value);
  520. $sql .= "('{$params_json}'),";
  521. }
  522. $sql = trim($sql, ',').';';
  523. $result = $this->getDbEntity()->insert_sql($sql);
  524. return $result;
  525. }
  526. //插入待发送短信参数数据
  527. public function add_sms_data_queue($data){
  528. $sql = 'INSERT INTO `ly_sms_data_tmp` (`params_json`) VALUES ';
  529. foreach($data as $value){
  530. $params_json = serialize($value);
  531. $sql .= "('{$params_json}'),";
  532. }
  533. $sql = trim($sql, ',').';';
  534. $result = $this->getDbEntity()->insert_sql($sql);
  535. return $result;
  536. }
  537. //插入待发送短信参数数据--牛信云
  538. public function add_sms_data_queue_new($data){
  539. $sql = 'INSERT INTO `ly_sms_data_tmp_new` (`params_json`) VALUES ';
  540. foreach($data as $value){
  541. $params_json = serialize($value);
  542. $sql .= "('{$params_json}'),";
  543. }
  544. $sql = trim($sql, ',').';';
  545. $result = $this->getDbEntity()->insert_sql($sql);
  546. return $result;
  547. }
  548. //查询代发邮件数量
  549. public function selectEmailTmpData(){
  550. $sql = 'SELECT COUNT(`id`) AS `ct` FROM `ly_email_data_tmp`;';
  551. $result = $this->getDbEntity()->query($sql);
  552. return $result;
  553. }
  554. //查询待发短信数量
  555. public function selectSmsTmpData(){
  556. $sql = 'SELECT COUNT(`id`) AS `ct` FROM `ly_sms_data_tmp`;';
  557. $result = $this->getDbEntity()->query($sql);
  558. return $result;
  559. }
  560. //end
  561. }