adminAction.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  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,is_send) 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,add_time) values
  96. ('{$data['email']}','{$data['add_time']}')";
  97. $result = $this->getDbEntity()->insert_sql($sql);
  98. return $result;
  99. }
  100. public function importBlacklist($values){
  101. $sql = "replace into ly_blacklist(email, add_time) values" . $values;
  102. $result = $this->getDbEntity()->insert_sql($sql);
  103. return $result;
  104. }
  105. public function selectCustomerCount($where){
  106. $sql = "select count(*) as count from ly_customer $where ";
  107. $result = $this->getDbEntity()->query($sql);
  108. return $result[0]['count'];
  109. }
  110. public function selectSmsCustomerCount($where){
  111. $sql = "select count(*) as count from ly_sms_customer $where ";
  112. $result = $this->getDbEntity()->query($sql);
  113. return $result[0]['count'];
  114. }
  115. public function selectBlacklistCount($where){
  116. $sql = "select count(*) as count from ly_blacklist $where ";
  117. $result = $this->getDbEntity()->query($sql);
  118. return $result[0]['count'];
  119. }
  120. //查询所有客户
  121. public function selesctCustomer($where,$limit){
  122. if(!empty($limit)){
  123. $sql = "select * from ly_customer $where order by id desc limit $limit ";
  124. }else{
  125. $sql = "select * from ly_customer $where order by id desc ";
  126. }
  127. $result = $this->getDbEntity()->query($sql);
  128. return $result;
  129. }
  130. public function selesctSmsCustomer($where,$limit=0){
  131. if(!empty($limit)){
  132. $sql = "select * from ly_sms_customer $where order by id desc limit $limit ";
  133. }else{
  134. $sql = "select * from ly_sms_customer $where order by id desc ";
  135. }
  136. $result = $this->getDbEntity()->query($sql);
  137. return $result;
  138. }
  139. public function selectSmsBlackList() {
  140. $sql = "select tel from ly_sms_customer where is_block=1 order by id desc ";
  141. $result = $this->getDbEntity()->query($sql);
  142. return $result;
  143. }
  144. //查询UID下所有客户Email
  145. public function selesctCustomerByUid($uid){
  146. $sql = "select email from ly_customer where 1=1 and uid = $uid ";
  147. $result = $this->getDbEntity()->query($sql);
  148. return $result;
  149. }
  150. //查询所有黑名单
  151. public function selesctBlacklist($where = '', $limit = 100){
  152. if(!empty($limit)){
  153. $sql = "select * from ly_blacklist $where order by id desc limit $limit ";
  154. }else{
  155. $sql = "select * from ly_blacklist $where order by id desc ";
  156. }
  157. $result = $this->getDbEntity()->query($sql);
  158. return $result;
  159. }
  160. public function selectAllBlack(){
  161. $sql = "select email from ly_blacklist";
  162. $result = $this->getDbEntity()->query($sql);
  163. return $result;
  164. }
  165. //查询客户信息
  166. public function selectOneCustomer($id){
  167. $sql = "select * from ly_customer where id='$id' ";
  168. $result = $this->getDbEntity()->query($sql);
  169. return $result[0];
  170. }
  171. //根据手机号查询客户信息
  172. public function selectOneCustomerBymobile($id){
  173. $sql = "select * from ly_sms_customer where tel='$id' ";
  174. $result = $this->getDbEntity()->query($sql);
  175. return $result[0];
  176. }
  177. public function selectOneSmsCustomer($id){
  178. $sql = "select * from ly_sms_customer where id='$id' ";
  179. $result = $this->getDbEntity()->query($sql);
  180. return $result[0];
  181. }
  182. //查询黑名单信息
  183. public function selectOneBlack($id){
  184. $sql = "select * from ly_blacklist where id='$id' ";
  185. $result = $this->getDbEntity()->query($sql);
  186. return $result[0];
  187. }
  188. //根据邮箱查询客户信息
  189. public function selectCustomerByEmail($email,$uid){
  190. $sql = "select * from ly_customer where email='$email' and uid='$uid' ";
  191. $result = $this->getDbEntity()->query($sql);
  192. return $result[0];
  193. }
  194. public function selectCustomerByTel($tel, $uid){
  195. $sql = "select * from ly_sms_customer where tel='$tel' and uid='$uid' ";
  196. $result = $this->getDbEntity()->query($sql);
  197. return $result[0];
  198. }
  199. //根据邮箱查询H黑名单信息
  200. public function selectBlackByEmail($email){
  201. $sql = "select * from ly_blacklist where email='$email' ";
  202. $result = $this->getDbEntity()->query($sql);
  203. return $result[0];
  204. }
  205. //编辑客户信息
  206. public function updateCustomer($data,$id){
  207. $sql = "update ly_customer set email='{$data['email']}',uname='{$data['uname']}',group_name='{$data['group_name']}',
  208. country = '{$data['country']}',city = '{$data['city']}',tel='{$data['tel']}'
  209. where id='$id'";
  210. $result = $this->getDbEntity()->execute_sql($sql);
  211. return $result;
  212. }
  213. public function updateSmsCustomerBlcak($data){
  214. $sql = "update ly_sms_customer set is_block=1
  215. where id={$data['id']}";
  216. $result = $this->getDbEntity()->execute_sql($sql);
  217. return $result;
  218. }
  219. public function updateSmsCustomer($data,$id){
  220. $sql = "update ly_sms_customer set uname='{$data['uname']}',group_name='{$data['group_name']}',
  221. country = '{$data['country']}',tel='{$data['tel']}'
  222. where id='$id'";
  223. $result = $this->getDbEntity()->execute_sql($sql);
  224. return $result;
  225. }
  226. //编辑黑名单信息
  227. public function updateBlack($data,$id){
  228. $sql = "update ly_blacklist set email='{$data['email']}'
  229. where id='$id'";
  230. $result = $this->getDbEntity()->execute_sql($sql);
  231. return $result;
  232. }
  233. //编辑客户信息
  234. public function updateCustomerByEmail($data){
  235. $sql = "update ly_customer set uname='{$data['uname']}',group_name='{$data['group_name']}',
  236. country = '{$data['country']}',city = '{$data['city']}',tel='{$data['tel']}'
  237. where uid='{$data['uid']}' and email='{$data['email']}'";
  238. $result = $this->getDbEntity()->execute_sql($sql);
  239. return $result;
  240. }
  241. //批量更新客户用户组信息
  242. public function updateCustomerGroupByEmail($data){
  243. $sql = "insert into ly_im_data_tmp (sql_content) values ";
  244. foreach ($data as $k => $v) {
  245. $sql_content['tabname'] = "ly_customer";
  246. $sql_content['exc'] = " update";
  247. $sql_content['data'] = $v;
  248. $sql .= "('".addslashes(serialize($sql_content))."'),";
  249. }
  250. $sql = substr($sql,0,-1);
  251. $sql .= ";";
  252. $result = $this->getDbEntity()->execute_sql($sql);
  253. return $result;
  254. }
  255. //删除客户信息
  256. public function deleteCustomer($id,$uid){
  257. $sql = "delete from ly_customer where id='$id' and uid='$uid' ";
  258. $result = $this->getDbEntity()->query($sql);
  259. return $result;
  260. }
  261. public function deleteSmsCustomer($id, $uid){
  262. $sql = "delete from ly_sms_customer where id='$id' and uid='$uid' ";
  263. $result = $this->getDbEntity()->query($sql);
  264. return $result;
  265. }
  266. public function deleteSmsCustomerByExcel($telsStr, $uid){
  267. $sql = "delete from ly_sms_customer where tel in ($telsStr) and uid='$uid' ";
  268. $result = $this->getDbEntity()->query($sql);
  269. return $result;
  270. }
  271. public function deleteSmsCustomerByTel($telsStr){
  272. $sql = "delete from ly_sms_customer where tel in ($telsStr) ";
  273. $result = $this->getDbEntity()->query($sql);
  274. return $result;
  275. }
  276. //删除黑名单
  277. public function deleteBlack($id){
  278. $sql = "delete from ly_blacklist where id='$id' ";
  279. $result = $this->getDbEntity()->query($sql);
  280. return $result;
  281. }
  282. //按客户分组删除客户信息
  283. public function deleteCustomerByGroup($group_name,$uid){
  284. $sql = "delete from ly_customer where group_name='$group_name' and uid='$uid' ";
  285. $result = $this->getDbEntity()->query($sql);
  286. return $result;
  287. }
  288. public function deleteSmsCustomerByGroup($group_name, $uid){
  289. $sql = "delete from ly_sms_customer where group_name='$group_name' and uid='$uid' ";
  290. $result = $this->getDbEntity()->query($sql);
  291. return $result;
  292. }
  293. //删除多个分组的客户信息
  294. public function deleteBatchCus($group_name,$uid){
  295. $sql = "delete from ly_customer where group_name in ($group_name) and uid='$uid' ";
  296. $result = $this->getDbEntity()->query($sql);
  297. return $result;
  298. }
  299. //批量删除客户信息
  300. public function deleteBatchCustomer($id_array,$uid){
  301. $sql = "delete from ly_customer where id in ($id_array) and uid='$uid' ";
  302. $result = $this->getDbEntity()->query($sql);
  303. return $result;
  304. }
  305. public function deleteBatchSmsCustomer($id_array, $uid){
  306. $sql = "delete from ly_sms_customer where id in ($id_array) and uid='$uid' ";
  307. $result = $this->getDbEntity()->query($sql);
  308. return $result;
  309. }
  310. //批量删除黑名单
  311. public function deleteBatchBlack($id_array){
  312. $sql = "delete from ly_blacklist where id in ($id_array) ";
  313. $result = $this->getDbEntity()->query($sql);
  314. return $result;
  315. }
  316. //批量删除用户分组
  317. public function deleteBatchUserGroup($id_array,$uid){
  318. $sql = "delete from ly_user_group where id in ($id_array) and uid='$uid' ";
  319. $result = $this->getDbEntity()->query($sql);
  320. return $result;
  321. }
  322. public function deleteBatchSmsUserGroup($id_array,$uid){
  323. $sql = "delete from ly_sms_user_group where id in ($id_array) and uid='$uid' ";
  324. $result = $this->getDbEntity()->query($sql);
  325. return $result;
  326. }
  327. //普通发送插入日志表 普通邮件发送日志表
  328. public function inserEmail1Log($data){
  329. $sql = "insert into ly_send_email1_log(to_user,subject,content,replay_to,`time`,message,uid) values
  330. ('{$data['to']}','{$data['subject']}','{$data['html']}','{$data['replyto']}','{$data['time']}','{$data['message']}','{$data['uid']}')";
  331. $result = $this->getDbEntity()->insert_sql($sql);
  332. return $result;
  333. }
  334. public function deleteBatchCustomerByEmail($id_array,$uid){
  335. $sql = "delete from ly_customer where email in ($id_array) and uid='$uid' ";
  336. $result = $this->getDbEntity()->query($sql);
  337. return $result;
  338. }
  339. //邮件模板列表
  340. public function select_msg_list($where,$limit){
  341. if(!empty($limit)){
  342. $sql = "select * from ly_email_template $where order by status asc,id desc limit $limit";
  343. }else{
  344. $sql = "select * from ly_email_template $where order by status asc,id desc";
  345. }
  346. $result = $this->getDbEntity()->query($sql);
  347. return $result;
  348. }
  349. //短信模板列表
  350. public function select_smstm_list($where,$limit=0){
  351. if(!empty($limit)){
  352. $sql = "select * from ly_sms_template $where order by status asc,id desc limit $limit";
  353. }else{
  354. $sql = "select * from ly_sms_template $where order by status asc,id desc";
  355. }
  356. $result = $this->getDbEntity()->query($sql);
  357. return $result;
  358. }
  359. //查询邮件模板数量
  360. public function select_msg_count($where){
  361. $sql = "select count(*) as count from ly_email_template $where ";
  362. $result = $this->getDbEntity()->query($sql);
  363. return $result[0]['count'];
  364. }
  365. //查询短信模板数量
  366. public function select_smstm_count($where){
  367. $sql = "select count(*) as count from ly_sms_template $where ";
  368. $result = $this->getDbEntity()->query($sql);
  369. return $result[0]['count'];
  370. }
  371. //添加邮件模板
  372. public function add_email_msg($data){
  373. $sql = "insert into ly_email_template(msg_title,msg_content,status,add_time,`update_time`,uid,`type`) values
  374. ('{$data['msg_title']}','{$data['msg_content']}','{$data['status']}','{$data['add_time']}','{$data['update_time']}','{$data['uid']}','{$data['type']}')";
  375. $result = $this->getDbEntity()->insert_sql($sql);
  376. return $result;
  377. }
  378. //添加短信模板
  379. public function add_smstm_msg($data){
  380. $sql = "insert into ly_sms_template(msg_title,msg_content,status,add_time,`update_time`,uid,`type`) values
  381. ('{$data['msg_title']}','{$data['msg_content']}','{$data['status']}','{$data['add_time']}','{$data['update_time']}','{$data['uid']}','{$data['type']}')";
  382. $result = $this->getDbEntity()->insert_sql($sql);
  383. return $result;
  384. }
  385. //查询某一个邮件模板
  386. public function select_one_template($id){
  387. $sql = "select * from ly_email_template where id='$id' ";
  388. $result = $this->getDbEntity()->query($sql);
  389. return $result[0];
  390. }
  391. //查询某一个短信模板
  392. public function select_onesms_template($id){
  393. $sql = "select * from ly_sms_template where id='$id' ";
  394. $result = $this->getDbEntity()->query($sql);
  395. return $result[0];
  396. }
  397. //修改邮件模板
  398. public function update_email_msg($data,$id,$uid){
  399. $sql = "update ly_email_template set msg_title='{$data['msg_title']}',msg_content='{$data['msg_content']}',
  400. status = '{$data['status']}',update_time = '{$data['update_time']}'
  401. where id='$id' and uid='$uid'";
  402. $result = $this->getDbEntity()->execute_sql($sql);
  403. return $result;
  404. }
  405. //修改短信模板
  406. public function update_smstm_msg($data,$id,$uid){
  407. $sql = "update ly_sms_template set msg_title='{$data['msg_title']}',msg_content='{$data['msg_content']}',
  408. status = '{$data['status']}',update_time = '{$data['update_time']}'
  409. where id='$id' and uid='$uid'";
  410. $result = $this->getDbEntity()->execute_sql($sql);
  411. return $result;
  412. }
  413. //禁用邮件模板
  414. public function deleteEmailTemplate($status,$id,$uid){
  415. $sql = "update ly_email_template set status='{$status}'
  416. where id='$id' and uid='$uid'";
  417. $result = $this->getDbEntity()->execute_sql($sql);
  418. return $result;
  419. }
  420. //禁用短信模板
  421. public function deleteSmsTemplate($status,$id,$uid){
  422. $sql = "update ly_sms_template set status='{$status}'
  423. where id='$id' and uid='$uid'";
  424. $result = $this->getDbEntity()->execute_sql($sql);
  425. return $result;
  426. }
  427. //查询所有用户分组
  428. public function select_user_group($where){
  429. $sql = "select * from ly_user_group $where order by position desc, id desc";
  430. $result = $this->getDbEntity()->query($sql);
  431. return $result;
  432. }
  433. //查询所有用户分组
  434. public function select_sms_user_group($where){
  435. $sql = "select * from ly_sms_user_group $where order by position desc, id desc";
  436. $result = $this->getDbEntity()->query($sql);
  437. return $result;
  438. }
  439. //添加用户分组
  440. public function add_user_group($data){
  441. $sql = "insert into ly_user_group(uid,`name`,add_time,update_time)
  442. values('{$data['uid']}','{$data['name']}','{$data['add_time']}','{$data['update_time']}')";
  443. $result = $this->getDbEntity()->insert_sql($sql);
  444. return $result;
  445. }
  446. public function add_sms_user_group($data){
  447. $sql = "insert into ly_sms_user_group(uid,`name`)
  448. values('{$data['uid']}','{$data['name']}')";
  449. $result = $this->getDbEntity()->insert_sql($sql);
  450. return $result;
  451. }
  452. //查询某个用户分组
  453. public function select_one_user_group($id,$uid){
  454. $sql = "select * from ly_user_group where id='$id' and uid='$uid'";
  455. $result = $this->getDbEntity()->query($sql);
  456. return $result[0];
  457. }
  458. //查询多个用户分组
  459. public function select_batch_user_group($in_array,$uid){
  460. $sql = "select * from ly_user_group where id in ($in_array) and uid='$uid'";
  461. $result = $this->getDbEntity()->query($sql);
  462. return $result;
  463. }
  464. public function select_batch_sms_group($in_array, $uid){
  465. $sql = "select * from ly_sms_user_group where id in ($in_array) and uid='$uid'";
  466. $result = $this->getDbEntity()->query($sql);
  467. return $result;
  468. }
  469. //判断客户分组
  470. public function select_group_byName($group_name,$uid){
  471. $sql = "select * from ly_user_group where name='$group_name' and uid='$uid'";
  472. $result = $this->getDbEntity()->query($sql);
  473. return $result[0];
  474. }
  475. public function select_usergroup_byName($group_name,$uid){
  476. $sql = "select * from ly_sms_user_group where name='$group_name' and uid='$uid'";
  477. $result = $this->getDbEntity()->query($sql);
  478. return $result[0];
  479. }
  480. public function select_usergroup_byId($id, $uid){
  481. $sql = "select * from ly_sms_user_group where id='$id' and uid='$uid'";
  482. $result = $this->getDbEntity()->query($sql);
  483. return $result[0];
  484. }
  485. //修改用户分组
  486. public function update_user_group($data, $id,$uid){
  487. $sql = "update ly_user_group set
  488. `name` = '{$data['name']}',
  489. `position` = '{$data['position']}',
  490. update_time = '{$data['update_time']}'
  491. where id='{$id}' and uid='$uid'";
  492. $result = $this->getDbEntity()->execute_sql($sql);
  493. return $result;
  494. }
  495. public function update_sms_user_group($data, $id, $uid){
  496. $sql = "update ly_sms_user_group set
  497. `name` = '{$data['name']}',
  498. `position` = '{$data['position']}'
  499. where id='{$id}' and uid='$uid'";
  500. $result = $this->getDbEntity()->execute_sql($sql);
  501. return $result;
  502. }
  503. //查询分组用户的数量
  504. public function select_usergroup_count($where){
  505. $sql = "select count(*) as count from ly_customer $where";
  506. $result = $this->getDbEntity()->query($sql);
  507. return $result[0];
  508. }
  509. //查询用户分组里的所有用户
  510. public function select_usergroup_info($where,$limit){
  511. if(!empty($limit)){
  512. $sql = "select * from ly_customer $where order by add_time desc limit $limit";
  513. }else{
  514. $sql = "select * from ly_customer $where order by add_time desc";
  515. }
  516. $result = $this->getDbEntity()->query($sql);
  517. return $result;
  518. }
  519. //删除用户分组
  520. public function deleteUserGroupMsg($where){
  521. $sql = " delete from ly_user_group where $where";
  522. $result = $this->getDbEntity()->query($sql);
  523. return $result;
  524. }
  525. public function deleteSmsUserGroupMsg($where){
  526. $sql = " delete from ly_sms_user_group where $where";
  527. $result = $this->getDbEntity()->query($sql);
  528. return $result;
  529. }
  530. //查询退信用户是否存在
  531. public function select_ndr_user($where,$email){
  532. $sql = " select email from ly_ndr_user where $where and email='$email'";
  533. $result = $this->getDbEntity()->query($sql);
  534. return $result;
  535. }
  536. //查询所有退信用户
  537. public function selectAllNdrUser($uid){
  538. $sql = "select email from ly_ndr_user where uid=$uid";
  539. $result = $this->getDbEntity()->query($sql);
  540. return $result;
  541. }
  542. //插入退信用户
  543. public function insert_ndr_user($data){
  544. $sql = "insert into ly_ndr_user(uid,email)
  545. values('{$data['uid']}','{$data['email']}')";
  546. $result = $this->getDbEntity()->insert_sql($sql);
  547. return $result;
  548. }
  549. //查询临时表数据
  550. public function select_tmp_data(){
  551. $sql = " select id from ly_im_data_tmp ";
  552. $result = $this->getDbEntity()->query($sql);
  553. return $result;
  554. }
  555. //插入待发送邮件参数数据
  556. public function add_email_data_queue($data){
  557. $sql = 'INSERT INTO `ly_email_data_tmp` (`params_json`) VALUES ';
  558. $params_json = '';
  559. foreach($data as $value){
  560. $params_json = serialize($value);
  561. $sql .= "('{$params_json}'),";
  562. }
  563. $sql = trim($sql, ',').';';
  564. $result = $this->getDbEntity()->insert_sql($sql);
  565. return $result;
  566. }
  567. //插入待发送短信参数数据
  568. public function add_sms_data_queue($data){
  569. $sql = 'INSERT INTO `ly_sms_data_tmp` (`params_json`) VALUES ';
  570. foreach($data as $value){
  571. $params_json = serialize($value);
  572. $sql .= "('{$params_json}'),";
  573. }
  574. $sql = trim($sql, ',').';';
  575. $result = $this->getDbEntity()->insert_sql($sql);
  576. return $result;
  577. }
  578. //插入待发送短信参数数据--牛信云
  579. public function add_sms_data_queue_new($data){
  580. $sql = 'INSERT INTO `ly_sms_data_tmp_new` (`params_json`) VALUES ';
  581. foreach($data as $value){
  582. $params_json = serialize($value);
  583. $sql .= "('{$params_json}'),";
  584. }
  585. $sql = trim($sql, ',').';';
  586. $result = $this->getDbEntity()->insert_sql($sql);
  587. return $result;
  588. }
  589. //查询代发邮件数量
  590. public function selectEmailTmpData(){
  591. $sql = 'SELECT COUNT(`id`) AS `ct` FROM `ly_email_data_tmp`;';
  592. $result = $this->getDbEntity()->query($sql);
  593. return $result;
  594. }
  595. //查询待发短信数量
  596. public function selectSmsTmpData(){
  597. $sql = 'SELECT COUNT(`id`) AS `ct` FROM `ly_sms_data_tmp`;';
  598. $result = $this->getDbEntity()->query($sql);
  599. return $result;
  600. }
  601. //查询美加州区号
  602. public function selectCityCode(){
  603. $sql = "select code from ly_country_code ";
  604. $result = $this->getDbEntity()->query($sql);
  605. return $result;
  606. }
  607. //更改美加州区号用户状态
  608. public function upCodeSmsCustomer($is_send,$id){
  609. $sql = "update ly_sms_customer set is_send='{$is_send}' where id='{$id}'";
  610. $result = $this->getDbEntity()->execute_sql($sql);
  611. return $result;
  612. }
  613. //end
  614. }