adminAction.php 24 KB

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