BmPromoterUserAction.class.php 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class BmPromoterUserAction extends CommonAction
  10. {
  11. public function __construct()
  12. {
  13. parent::__construct();
  14. require_once APP_ROOT_PATH . "/admin/Lib/Action/UserCommonAction.class.php";
  15. require_once APP_ROOT_PATH . "/system/libs/user.php";
  16. }
  17. public function index()
  18. {
  19. //$common = new UserCommon();
  20. $data = $_REQUEST;
  21. // $data['is_authentication'] = array('in',array(0,1,3));
  22. $data['is_robot'] = 0;
  23. if (trim($data['nick_name']) != '') {
  24. $parameter .= "nick_name like " . urlencode('%' . trim($data['nick_name']) . '%') . "&";
  25. $sql_w .= "nick_name like '%" . trim($data['nick_name']) . "%' and ";
  26. }
  27. if (trim($data['mobile']) != '') {
  28. $parameter .= "mobile like " . urlencode('%' . trim($data['mobile']) . '%') . "&";
  29. $sql_w .= "mobile like '%" . trim($data['mobile']) . "%' and ";
  30. }
  31. $create_time_2 = empty($_REQUEST['create_time_2']) ? to_date(get_gmtime(),
  32. 'Y-m-d') : strim($data['create_time_2']);
  33. $create_time_2 = to_timespan($create_time_2) + 24 * 3600;
  34. if (trim($data['create_time_1']) != '') {
  35. $parameter .= "create_time between '" . to_timespan($data['create_time_1']) . "' and '" . $create_time_2 . "'&";
  36. $sql_w .= " (create_time between '" . to_timespan($data['create_time_1']) . "' and '" . $create_time_2 . "' ) and ";
  37. }
  38. if (intval($data['id']) > 0) {
  39. $parameter .= "id=" . intval($data['id']) . "&";
  40. $sql_w .= "id=" . intval($data['id']) . " and ";
  41. }
  42. if ($data['is_effect'] != null) {
  43. $parameter .= "is_effect=" . intval($data['is_effect']) . "&";
  44. $sql_w .= "is_effect=" . intval($data['is_effect']) . " and ";
  45. } else {
  46. $parameter .= "is_effect=1&";
  47. $sql_w .= "is_effect=1 and ";
  48. }
  49. if ($_REQUEST['is_admin'] != '') {
  50. $parameter .= "is_admin=" . intval($data['is_admin']) . "&";
  51. $sql_w .= "is_admin=" . intval($data['is_admin']) . " and ";
  52. }
  53. if (!isset($_REQUEST['anchor_type'])) {
  54. $_REQUEST['anchor_type'] = -1;
  55. }
  56. $data['anchor_type']=intval($_REQUEST['anchor_type']);
  57. if($data['anchor_type'] ==0){
  58. //普通会员
  59. $parameter .= "anchor_type=" . $data['anchor_type'] . "&";
  60. $sql_w .= "is_authentication in (0,1,3) and ";
  61. }elseif($data['anchor_type'] ==1){
  62. //普通主播
  63. $parameter .= "anchor_type=" . $data['anchor_type'] . "&";
  64. $sql_w .= "is_authentication = 2 and bm_special=0";
  65. }elseif($data['anchor_type'] ==2){
  66. //签约主播
  67. $parameter .= "anchor_type=" . $data['anchor_type'] . "&";
  68. $sql_w .= "is_authentication = 2 and bm_special=1";
  69. }
  70. $bm_promoter_id = intval($data['bm_promoter_id']);
  71. if ($bm_promoter_id > 0) {
  72. $bm_pid=$GLOBALS['db']->getOne("select user_id from ".DB_PREFIX."bm_promoter where id=".$bm_promoter_id." ");
  73. $parameter .= "bm_pid=" . $bm_pid . "&";
  74. $sql_w .= "bm_pid=" . $bm_pid . " and ";
  75. } else {
  76. $sql_w .= "bm_pid >0 and ";
  77. }
  78. if (isset($data['is_robot'])) {
  79. $parameter .= "is_robot=" . intval($data['is_robot']) . "&";
  80. $sql_w .= "is_robot=" . intval($data['is_robot']) . " and ";
  81. } else {
  82. $parameter .= "is_robot=0&";
  83. $sql_w .= "is_robot=0 and ";
  84. }
  85. $m_config = load_auto_cache("m_config");//初始化手机端配置
  86. if (defined('OPEN_VIP') && OPEN_VIP == 1) {
  87. if ($_REQUEST['is_vip'] != '') {
  88. $parameter .= "is_vip=" . intval($data['is_vip']) . "&";
  89. $sql_w .= "is_vip=" . intval($data['is_vip']) . " and ";
  90. }
  91. $this->assign('open_vip', 1);
  92. }
  93. $model = D();
  94. $m_config = load_auto_cache("m_config");
  95. $ote = floatval($m_config['onlinetime_to_experience']);
  96. $sql_str = "SELECT *," .
  97. " ticket-refund_ticket as useable_ticket ,floor(score + online_time*" . $ote . ") as u_score" .
  98. " FROM " . DB_PREFIX . "user WHERE 1=1 ";
  99. $count_sql = "SELECT count(*) as tpcount" .
  100. " FROM " . DB_PREFIX . "user WHERE (1=1 ";
  101. if (intval($data['id']) == 0) {
  102. $sql_str .= " and " . $sql_w . " 1=1 ";
  103. $count_sql .= " and " . $sql_w . " 1=1) ";
  104. } else {
  105. $sql_str .= " and " . $sql_w . " 1=1 union SELECT *," .
  106. " ticket-refund_ticket as useable_ticket ,floor(score + online_time*" . $ote . ") as u_score" .
  107. " FROM " . DB_PREFIX . "user WHERE luck_num=" . $data['id'];
  108. $count_sql .= " and " . $sql_w . " 1=1 ) or (luck_num=" . $data['id'] . ")";
  109. }
  110. $distribution_log = 0;
  111. if (defined('OPEN_DISTRIBUTION') && OPEN_DISTRIBUTION == 1) {
  112. $distribution_log = 1;
  113. }
  114. $coins = 0;
  115. if (defined('OPEN_GAME_MODULE') && OPEN_GAME_MODULE == 1) {
  116. $coins = 1;
  117. }
  118. $goods = 0;
  119. if ((defined('SHOPPING_GOODS') && SHOPPING_GOODS == 1) || (defined('PAI_REAL_BTN') && PAI_REAL_BTN == 1)) {
  120. $goods = 1;
  121. }
  122. $voList = $this->_Sql_list($model, $sql_str, "&" . $parameter, 'id', 0, $count_sql);
  123. foreach ($voList as $k => $v) {
  124. $voList[$k]['head_image'] = get_spec_image($v['head_image']);
  125. $voList[$k]['distribution_log'] = $distribution_log;
  126. $voList[$k]['coins'] = $coins;
  127. $voList[$k]['goods'] = $goods;
  128. $voList[$k]['ticket'] = $v['ticket'] + $v['no_ticket'];
  129. }
  130. $this->assign('list', $voList);
  131. $this->display();
  132. }
  133. public function edit()
  134. {
  135. $data = $_REQUEST;
  136. $id = intval($data['id']);
  137. $condition['id'] = $id;
  138. $vo = M('User')->where($condition)->find();
  139. $vo['ban_time'] = $vo['ban_time'] > 0 ? to_date($vo['ban_time']) : '';
  140. $vo['create_time'] = $vo['create_time'] > 0 ? to_date($vo['create_time']) : '';
  141. $vo['nick_name'] = emoji_decode($vo['nick_name']);
  142. $vo['signature'] = emoji_decode($vo['signature']);
  143. $m_config = load_auto_cache("m_config");//初始化手机端配置
  144. if (defined('OPEN_VIP') && OPEN_VIP == 1) {
  145. $this->assign('open_vip', 1);
  146. $vip_expire_time = $vo['vip_expire_time'];
  147. $vo['vip_expire_time'] = '';
  148. if (intval($vo['is_vip']) == 1) {
  149. $vo['vip_expire_time'] = $vip_expire_time > 0 ? to_date($vip_expire_time) : '';
  150. if ($vip_expire_time > 0 && $vip_expire_time < NOW_TIME) {
  151. $vo['is_vip'] = 0;
  152. $vo['vip_expire_time'] = '';
  153. $sql = "update " . DB_PREFIX . "user set is_vip = 0 where id = " . $id;
  154. $GLOBALS['db']->query($sql);
  155. user_deal_to_reids(array($id));
  156. }
  157. }
  158. }
  159. if (defined('OPEN_DISTRIBUTION') && OPEN_DISTRIBUTION == 1) {
  160. $this->assign('open_distribution', 1);
  161. }
  162. $user_level = $GLOBALS['db']->getOne("select user_level from " . DB_PREFIX . "user where id = " . $id); //二级地址
  163. $vo['user_level'] = $user_level > 0 ? $user_level : 1;
  164. //过滤头像是本地连接的问题
  165. $vo['head_image'] = get_spec_image($vo['head_image'], 50, 50);
  166. //关联上级id
  167. $vo['bm_promoter_id'] = M("BmPromoter")->where("user_id=" . intval($vo['bm_pid']) . "")->getField("id");
  168. $this->assign('vo', $vo);
  169. $region_pid = 0;
  170. $region_lv2 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where region_level = 2 order by py asc"); //二级地址
  171. foreach ($region_lv2 as $k => $v) {
  172. if ($v['name'] == $vo['province']) {
  173. $region_lv2[$k]['selected'] = 1;
  174. $region_pid = $region_lv2[$k]['id'];
  175. break;
  176. }
  177. }
  178. $this->assign("region_lv2", $region_lv2);
  179. if ($region_pid > 0) {
  180. $region_lv3 = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "region_conf where pid = " . $region_pid . " order by py asc"); //三级地址
  181. foreach ($region_lv3 as $k => $v) {
  182. if ($v['name'] == $vo['city']) {
  183. $region_lv3[$k]['selected'] = 1;
  184. break;
  185. }
  186. }
  187. $this->assign("region_lv3", $region_lv3);
  188. }
  189. //会员等级信息
  190. $user_level = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user_level where `level`>=" . $user_level . " order by level ASC");
  191. $this->assign("user_level", $user_level);
  192. //认证类型
  193. $authent_list = M("AuthentList")->findAll();
  194. $this->assign("authent_list", $authent_list);
  195. //分类
  196. $classifi_list = M("VideoClassified")->findAll();
  197. $this->assign("classified_id", $classifi_list);
  198. if (defined('OPEN_EDU_MODULE') && OPEN_EDU_MODULE == 1) {
  199. if ($vo['authentication_type'] == '教师') {
  200. $teacher = M('EduTeacher')->where(array('user_id' => $vo['id']))->find();
  201. $this->assign('teaching_certificate', get_spec_image($teacher['teaching_certificate']));
  202. $this->assign('education_certificate', get_spec_image($teacher['education_certificate']));
  203. } elseif ($vo['authentication_type'] == '机构') {
  204. $org = M('EduOrg')->where(array('user_id' => $vo['id']))->find();
  205. $this->assign('business_license', get_spec_image($org['business_license']));
  206. }
  207. }
  208. //是否显示身份证号码
  209. $show_identify_number = intval($m_config['is_show_identify_number']);
  210. $this->assign('show_identify_number', $show_identify_number);
  211. $this->display();
  212. }
  213. public function delete()
  214. {
  215. //彻底删除指定记录
  216. $common = new UserCommon();
  217. $data = $_REQUEST;
  218. $common->delete($data);
  219. }
  220. public function update()
  221. {
  222. B('FilterString');
  223. $data = M('User')->create();
  224. //开始验证有效性
  225. $this->assign("jumpUrl", u(MODULE_NAME . "/edit", array("id" => $data['id'])));
  226. $old_user_info = M('User')->where("id=" . $data['id'])->find();
  227. //app和admin共用user.php的save_user方法,后台update是没有验证码的,所以save_user设置标示字段$update_status
  228. $user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($data['id']));
  229. /*if($user_info['user_level'] != $data['user_level']){
  230. //require_once APP_ROOT_PATH.'mapi/lib/redis/BaseRedisService.php';
  231. //require_once(APP_ROOT_PATH.'mapi/lib/redis/UserRedisService.php');
  232. //$user_redis = new UserRedisService();
  233. $score = $GLOBALS['db']->getOne("select score from ".DB_PREFIX."user_level where `level` = ".$data['user_level']);
  234. //$online_time = $user_redis->getOne_db($data['id'],'online_time');
  235. //$online_time = intval($online_time)>0?intval($online_time):0;
  236. //$score = $score - floor($online_time/app_conf('ONLINETIME_TO_EXPERIENCE'));
  237. $user_info['score'] = $score;
  238. }*/
  239. if ($user_info['login_type'] == 2 && empty($data['mobile'])) {
  240. $this->error('手机注册用户,手机号不能为空');
  241. } else {
  242. $user_info['mobile'] = $data['mobile'];
  243. }
  244. $user_info['user_level'] = $data['user_level'];
  245. if ($data['v_explain'] == '') {
  246. $data['v_explain'] = $data['authentication_type'];
  247. }
  248. $data['v_icon'] = get_spec_image(M('AuthentList')->where("name='" . trim($data['authentication_type'] . "'"))->getField("icon"));
  249. $data['authent_list_id'] = get_spec_image(M('AuthentList')->where("name='" . trim($data['authentication_type'] . "'"))->getField("id"));
  250. $data['nick_name'] = emoji_encode($data['nick_name']);
  251. $data['signature'] = emoji_encode($data['signature']);
  252. //上级id
  253. $bm_promoter_id = intval($_REQUEST['bm_promoter_id']);
  254. if ($bm_promoter_id <= 0) {
  255. $this->error('请输入关联的上级ID');
  256. } else {
  257. $bm_promoter_info_new=M("BmPromoter")->where("id=".$bm_promoter_id."")->find();
  258. if(!$bm_promoter_info_new || $bm_promoter_info_new['is_effect'] !=1){
  259. $this->error('无效的关联的上级ID');
  260. }
  261. if($bm_promoter_info_new['pid'] ==0){
  262. $this->error('关联的上级ID不能是推广中心的id');
  263. }
  264. $new_bm_pid=$bm_promoter_info_new['user_id'];
  265. }
  266. $user_info = array_merge($user_info, $data);
  267. if (defined('GAME_DISTRIBUTION') && GAME_DISTRIBUTION == 1) {
  268. if ($user_info['id'] == $user_info['game_distribution_id']) {
  269. $this->error('推荐人不能为自己');
  270. }
  271. if ($user_info['game_distribution_id']) {
  272. $distribution = M('User')->where(['id' => $user_info['game_distribution_id']])->find();
  273. if (!$distribution) {
  274. $this->error('推荐人ID不存在');
  275. }
  276. }
  277. }
  278. $res = save_user($user_info, 'UPDATE', $update_status = 0);
  279. if ($res['status'] == 0) {
  280. $error_field = $res['data'];
  281. if ($error_field['error'] == EMPTY_ERROR) {
  282. if ($error_field['field_name'] == 'user_name') {
  283. $this->error(L("USER_NAME_EMPTY_TIP"));
  284. } elseif ($error_field['field_name'] == 'email') {
  285. $this->error(L("USER_EMAIL_EMPTY_TIP"));
  286. } else {
  287. $this->error(sprintf(L("USER_EMPTY_ERROR"), $error_field['field_show_name']));
  288. }
  289. } elseif ($error_field['error'] == FORMAT_ERROR) {
  290. if ($error_field['field_name'] == 'email') {
  291. $this->error(L("USER_EMAIL_FORMAT_TIP"));
  292. }
  293. if ($error_field['field_name'] == 'mobile') {
  294. $this->error(L("USER_MOBILE_FORMAT_TIP"));
  295. }
  296. } elseif ($error_field['error'] == EXIST_ERROR) {
  297. if ($error_field['field_name'] == 'user_name') {
  298. $this->error(L("USER_NAME_EXIST_TIP"));
  299. }
  300. if ($error_field['field_name'] == 'email') {
  301. $this->error(L("USER_EMAIL_EXIST_TIP"));
  302. }
  303. if ($error_field['field_name'] == 'mobile') {
  304. $this->error(L("USER_MOBILE_EXIST_TIP"));
  305. }
  306. } else {
  307. $this->error($res['error']);
  308. }
  309. }
  310. //开始更新is_effect状态
  311. M("User")->where("id=" . intval($data['id']))->setField("is_effect", intval($data['is_effect']));
  312. $user_id = intval($data['id']);
  313. $log_info = '';
  314. if ($data['user_level'] != $old_user_info['user_level']) {
  315. $log_info .= " 等级从" . $old_user_info['user_level'] . "级变为" . $data['user_level'] . "级";
  316. }
  317. if ($data['is_authentication'] != $old_user_info['is_authentication']) {
  318. $log_info .= " 认证状态从" . $this->get_authentication($old_user_info['is_authentication']) . "变为" . $this->get_authentication($data['is_authentication']);
  319. }
  320. //更新关联上级id成功后,重新统计上级子级个数
  321. if($old_user_info['bm_pid']>0 && $new_bm_pid>0 && $old_user_info['bm_pid'] != $new_bm_pid){
  322. $re=$GLOBALS['db']->query("update " . DB_PREFIX . "user set bm_pid= ".$new_bm_pid." where id=".intval($old_user_info['id'])."");
  323. if($re){
  324. //新
  325. $GLOBALS['db']->query("update " . DB_PREFIX . "bm_promoter set child_count=(SELECT count(*) from " . DB_PREFIX . "user where bm_pid=" . intval($new_bm_pid) . " and is_effect=1 ) where user_id= " . intval($new_bm_pid) . "");
  326. //旧
  327. $GLOBALS['db']->query("update " . DB_PREFIX . "bm_promoter set child_count=(SELECT count(*) from " . DB_PREFIX . "user where bm_pid=" . intval($old_user_info['bm_pid']) . " and is_effect=1 ) where user_id= " . intval($old_user_info['bm_pid']) . "");
  328. }
  329. }
  330. save_log($user_id . L("UPDATE_SUCCESS") . $log_info, 1);
  331. $this->success(L("UPDATE_SUCCESS"));
  332. }
  333. public function get_authentication($is_authentication){
  334. switch($is_authentication){
  335. case 1:
  336. return "待审核";
  337. break;
  338. case 2:
  339. return "已认证";
  340. break;
  341. case 3:
  342. return "认证不通过";
  343. break;
  344. default:
  345. return "未认证";
  346. }
  347. }
  348. public function set_effect()
  349. {
  350. $common = new UserCommon();
  351. $data = $_REQUEST;
  352. $n_is_effect = $common->set_effect($data);
  353. $this->ajaxReturn($n_is_effect, l("SET_EFFECT_" . $n_is_effect), 1);
  354. }
  355. public function set_ban()
  356. {
  357. $common = new UserCommon();
  358. $data = $_REQUEST;
  359. $n_is_effect = $common->set_ban($data);
  360. $this->ajaxReturn($n_is_effect, l("SET_BAN_" . $n_is_effect), 1);
  361. }
  362. //禁热门
  363. public function set_hot_on()
  364. {
  365. $common = new UserCommon();
  366. $data = $_REQUEST;
  367. $n_is_effect = $common->set_hot_on($data);
  368. $this->ajaxReturn($n_is_effect, l("SET_HOT_ON_" . $n_is_effect), 1);
  369. }
  370. //新增关注
  371. public function add_focus()
  372. {
  373. $common = new UserCommon();
  374. $data = $_REQUEST;
  375. $common->add_focus($data);
  376. }
  377. //新增关注
  378. public function set_follow()
  379. {
  380. $common = new UserCommon();
  381. $data = $_REQUEST;
  382. $common->set_follow($data);
  383. }
  384. //关注列表
  385. public function focus_list()
  386. {
  387. $common = new UserCommon();
  388. $data = $_REQUEST;
  389. $common->focus_list($data);
  390. }
  391. //新增粉丝
  392. public function add_fans()
  393. {
  394. $common = new UserCommon();
  395. $data = $_REQUEST;
  396. $common->add_fans($data);
  397. }
  398. //新增粉丝
  399. public function set_follower()
  400. {
  401. $common = new UserCommon();
  402. $data = $_REQUEST;
  403. $common->set_follower($data);
  404. }
  405. //粉丝列表
  406. public function fans_list()
  407. {
  408. $common = new UserCommon();
  409. $data = $_REQUEST;
  410. $common->fans_list($data);
  411. }
  412. //删除关注
  413. public function del_focus_list()
  414. {
  415. $common = new UserCommon();
  416. $data = $_REQUEST;
  417. $common->del_focus_list($data);
  418. }
  419. //删除粉丝
  420. public function del_fans_list()
  421. {
  422. $common = new UserCommon();
  423. $data = $_REQUEST;
  424. $common->del_fans_list($data);
  425. }
  426. //印票贡献榜
  427. public function contribution_list()
  428. {
  429. $common = new UserCommon();
  430. $data = $_REQUEST;
  431. $common->contribution_list($data);
  432. }
  433. /**
  434. * 删除印票贡献榜
  435. */
  436. /*public function del_contribution_list()
  437. {
  438. $ajax = intval($_REQUEST['ajax']);
  439. $id = $_REQUEST ['id'];
  440. if (isset ( $id )) {
  441. $common = new UserCommon();
  442. $data = $_REQUEST;
  443. $status = $common->del_contribution_list($data);
  444. if ($status!==false) {
  445. $this->success (l("FOREVER_DELETE_SUCCESS"),$ajax);
  446. } else {
  447. $this->error (l("FOREVER_DELETE_FAILED"),$ajax);
  448. }
  449. } else {
  450. $this->error (l("INVALID_OPERATION"),$ajax);
  451. }
  452. }*/
  453. //消息推送
  454. public function push()
  455. {
  456. $common = new UserCommon();
  457. $data = $_REQUEST;
  458. $common->push($data);
  459. }
  460. //删除推送消息
  461. public function del_push()
  462. {
  463. $ajax = intval($_REQUEST['ajax']);
  464. $id = $_REQUEST ['id'];
  465. if (isset ($id)) {
  466. $common = new UserCommon();
  467. $data = $_REQUEST;
  468. $status = $common->del_push($data);
  469. if ($status !== false) {
  470. $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
  471. } else {
  472. $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
  473. }
  474. } else {
  475. $this->error(l("INVALID_OPERATION"), $ajax);
  476. }
  477. }
  478. //账户管理
  479. public function account()
  480. {
  481. $common = new UserCommon();
  482. $data = $_REQUEST;
  483. $status = $common->account($data);
  484. }
  485. //账户修改
  486. public function modify_account()
  487. {
  488. $common = new UserCommon();
  489. $data = $_REQUEST;
  490. $status = $common->modify_account($data);
  491. if ($status) {
  492. $this->success(L("UPDATE_SUCCESS"));
  493. } else {
  494. $this->error("累计充值数据有误!");
  495. }
  496. }
  497. //账户日志
  498. public function account_detail()
  499. {
  500. $common = new UserCommon();
  501. $data = $_REQUEST;
  502. $common->account_detail($data);
  503. }
  504. //兑换日志
  505. public function exchange_log()
  506. {
  507. $common = new UserCommon();
  508. $data = $_REQUEST;
  509. $common->exchange_log($data);
  510. }
  511. //删除账户日志
  512. public function foreverdelete_account_detail()
  513. {
  514. //彻底删除指定记录
  515. $ajax = intval($_REQUEST['ajax']);
  516. $id = $_REQUEST ['id'];
  517. $data = $_REQUEST;
  518. if (isset ($id)) {
  519. $common = new UserCommon();
  520. $status = $common->foreverdelete_account_detail($data);
  521. if ($status !== false) {
  522. $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
  523. } else {
  524. $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
  525. }
  526. } else {
  527. $this->error(l("INVALID_OPERATION"), $ajax);
  528. }
  529. }
  530. //删除兑换日志
  531. public function foreverdelete_exchange_log()
  532. {
  533. //彻底删除指定记录
  534. $ajax = intval($_REQUEST['ajax']);
  535. $id = $_REQUEST ['id'];
  536. $data = $_REQUEST;
  537. if (isset ($id)) {
  538. $common = new UserCommon();
  539. $status = $common->foreverdelete_exchange_log($data);
  540. if ($status !== false) {
  541. $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
  542. } else {
  543. $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
  544. }
  545. } else {
  546. $this->error(l("INVALID_OPERATION"), $ajax);
  547. }
  548. }
  549. //检查用户
  550. public function check_user()
  551. {
  552. $common = new UserCommon();
  553. $user_id = $_REQUEST['id'];
  554. admin_ajax_return($common->check_user($user_id));
  555. }
  556. //礼物日志
  557. public function prop()
  558. {
  559. $common = new UserCommon();
  560. $data = $_REQUEST;
  561. $common->prop($data);
  562. }
  563. //收礼物日志
  564. public function closed_prop()
  565. {
  566. $data = $_REQUEST;
  567. $now = get_gmtime();
  568. $user_id = intval($_REQUEST['id']);
  569. $user_info = M("User")->getById($user_id);
  570. $prop_list = M("prop")->where("is_effect <>0")->findAll();
  571. $where = "l.to_user_id=" . $user_id;
  572. $model = D("video_prop");
  573. //赠送时间
  574. $current_Year = date('Y');
  575. $current_YM = date('Ym');
  576. for ($i = 0; $i < 5; $i++) {
  577. $years[$i] = $current_Year - $i;
  578. }
  579. for ($i = 01; $i < 13; $i++) {
  580. $month[$i] = str_pad(0 + $i, 2, 0, STR_PAD_LEFT);
  581. }
  582. if (strim($data['years']) != -1 && strim($data['month'] != -1)) {
  583. $time = $data['years'] . '' . $data['month'];
  584. } else {
  585. $time = $current_YM;
  586. }
  587. if (strim($data['years']) != -1 && strim($data['month'] == -1)) {
  588. $this->error("请选择月份");
  589. }
  590. if (strim($data['years']) == -1 && strim($data['month'] != -1)) {
  591. $this->error("请选择年份");
  592. }
  593. //查询ID
  594. if (strim($data['from_user_id']) != '') {
  595. $parameter .= "l.from_user_id=" . intval($data['from_user_id']) . "&";
  596. $sql_w .= "l.from_user_id=" . intval($data['from_user_id']) . " and ";
  597. }
  598. //查询昵称
  599. if (trim($data['nick_name']) != '') {
  600. $parameter .= "u.nick_name like " . urlencode('%' . trim($data['nick_name']) . '%') . "&";
  601. $sql_w .= "u.nick_name like '%" . trim($data['nick_name']) . "%' and ";
  602. }
  603. if (!isset($_REQUEST['prop_id'])) {
  604. $_REQUEST['prop_id'] = -1;
  605. }
  606. //查询礼物
  607. if ($_REQUEST['prop_id'] != -1) {
  608. if (isset($data['prop_id'])) {
  609. $parameter .= "l.prop_id=" . intval($data['prop_id']) . "&";
  610. $sql_w .= "l.prop_id=" . intval($data['prop_id']) . " and ";
  611. }
  612. }
  613. //默认查询本月的记录,选择查询时间时,如果查询时间 不等于当前时间,则查询他表
  614. if ($data['years'] != '' && $data['month'] != '') {
  615. $sql_str = "SELECT l.id,l.create_ym,l.to_user_id, l.create_time,l.prop_id,l.prop_name,l.from_user_id,l.create_date,l.num,l.total_ticket,u.nick_name
  616. FROM " . DB_PREFIX . "video_prop_" . $time . " as l
  617. LEFT JOIN " . DB_PREFIX . "user AS u ON l.from_user_id = u.id" . " LEFT JOIN " . DB_PREFIX . "prop AS v ON l.prop_name = v.name" . "
  618. WHERE $where " . " and " . $sql_w . " 1=1 ";
  619. $count_sql = "SELECT count(l.id) as tpcount
  620. FROM " . DB_PREFIX . "video_prop_" . $time . " as l
  621. LEFT JOIN " . DB_PREFIX . "user AS u ON l.from_user_id = u.id" . " LEFT JOIN " . DB_PREFIX . "prop AS v ON l.prop_name = v.name" . "
  622. WHERE $where " . " and " . $sql_w . " 1=1 ";
  623. $total_ticket_sql = "SELECT SUM(l.total_ticket) as tpcount
  624. FROM " . DB_PREFIX . "video_prop_" . $time . " as l
  625. LEFT JOIN " . DB_PREFIX . "user AS u ON l.from_user_id = u.id" . " LEFT JOIN " . DB_PREFIX . "prop AS v ON l.prop_name = v.name" . "
  626. WHERE $where " . " and " . $sql_w . " 1=1 ";
  627. } else {
  628. $sql_str = "SELECT l.id,l.create_ym,l.to_user_id, l.create_time,l.prop_id,l.prop_name,l.from_user_id,l.create_date,l.num,l.total_ticket,u.nick_name
  629. FROM " . DB_PREFIX . "video_prop_" . date('Ym', NOW_TIME) . " as l
  630. LEFT JOIN " . DB_PREFIX . "user AS u ON l.from_user_id = u.id" . " LEFT JOIN " . DB_PREFIX . "prop AS v ON l.prop_name = v.name" . "
  631. WHERE $where " . " and " . $sql_w . " 1=1 ";
  632. $count_sql = "SELECT count(l.id) as tpcount
  633. FROM " . DB_PREFIX . "video_prop_" . date('Ym', NOW_TIME) . " as l
  634. LEFT JOIN " . DB_PREFIX . "user AS u ON l.from_user_id = u.id" . " LEFT JOIN " . DB_PREFIX . "prop AS v ON l.prop_name = v.name" . "
  635. WHERE $where " . " and " . $sql_w . " 1=1 ";
  636. $total_ticket_sql = "SELECT SUM(l.total_ticket) as tpcount
  637. FROM " . DB_PREFIX . "video_prop_" . date('Ym', NOW_TIME) . " as l
  638. LEFT JOIN " . DB_PREFIX . "user AS u ON l.from_user_id = u.id" . " LEFT JOIN " . DB_PREFIX . "prop AS v ON l.prop_name = v.name" . "
  639. WHERE $where " . " and " . $sql_w . " 1=1 ";
  640. }
  641. $count = $GLOBALS['db']->getOne($count_sql);
  642. $total_ticket = $GLOBALS['db']->getOne($total_ticket_sql);
  643. $volist = $this->_Sql_list($model, $sql_str, '&' . $parameter, 1, 0, $count_sql);
  644. foreach ($volist as $k => $v) {
  645. if ($volist[$k]['prop_id'] == 12) {
  646. $volist[$k]['total_ticket'] = '';
  647. }
  648. $volist[$k]['create_time'] = date('Y-m-d', $volist[$k]['create_time']);
  649. }
  650. $this->assign("user_info", $user_info);
  651. $this->assign("prop", $prop_list);
  652. $this->assign("years", $years);
  653. $this->assign("month", $month);
  654. $this->assign("list", $volist);
  655. $this->assign("count", intval($count));
  656. $this->assign('total_ticket', intval($total_ticket));
  657. $this->display();
  658. }
  659. //分享奖励
  660. public function distribution_log()
  661. {
  662. $common = new UserCommon();
  663. $data = $_REQUEST;
  664. $common->distribution_log($data);
  665. }
  666. //分销子成员奖励
  667. public function distribution_user()
  668. {
  669. $common = new UserCommon();
  670. $data = $_REQUEST;
  671. $common->distribution_user($data);
  672. }
  673. //删除礼物日志
  674. public function delete_prop()
  675. {
  676. //彻底删除指定记录
  677. $ajax = intval($_REQUEST['ajax']);
  678. $id = intval($_REQUEST ['id']);
  679. $data = $_REQUEST;
  680. if (isset ($id)) {
  681. $common = new UserCommon();
  682. $status = $common->del_prop($data);
  683. if ($status !== false) {
  684. $this->success(l("FOREVER_DELETE_SUCCESS"), $ajax);
  685. } else {
  686. $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
  687. }
  688. } else {
  689. $this->error(l("INVALID_OPERATION"), $ajax);
  690. }
  691. }
  692. public function forbid_msg()
  693. {
  694. $common = new UserCommon();
  695. $data = $_REQUEST;
  696. $common->forbid_msg($data);
  697. }
  698. //商品管理
  699. public function goods()
  700. {
  701. $user_id = intval($_REQUEST['user_id']);
  702. if (strim($_REQUEST['name']) != '') {
  703. $map['name'] = array('like', '%' . strim($_REQUEST['name']) . '%');
  704. }
  705. $map['is_effect'] = 1;
  706. $model = D('goods');
  707. if (!empty ($model)) {
  708. $this->_list($model, $map);
  709. }
  710. $list = $this->get('list');
  711. $user_list = $GLOBALS['db']->getAll("select goods_id from " . DB_PREFIX . "user_goods where is_effect=1 and user_id=" . $user_id);
  712. foreach ($list as $k => $v) {
  713. $imgs = array();
  714. $imgs_details = array();
  715. $imgs = json_decode($v['imgs'], 1);
  716. $imgs_details = json_decode($v['imgs_details'], 1);
  717. $list[$k]['imgs'] = $imgs[0];
  718. $list[$k]['imgs_details'] = $imgs_details[0];
  719. $list[$k]['has'] = '否';
  720. foreach ($user_list as $value1) {
  721. if ($v['id'] == $value1['goods_id']) {
  722. $list[$k]['has'] = '是';
  723. break;
  724. }
  725. }
  726. }
  727. $sort = array_column($list, 'has');
  728. array_multisort($sort, SORT_DESC, $list);
  729. $this->assign("list", $list);
  730. $this->display();
  731. }
  732. //上架商品
  733. public function shelves()
  734. {
  735. $ajax = intval($_REQUEST['ajax']);
  736. $goods_id = intval($_REQUEST ['id']);
  737. $user_id = intval($_REQUEST ['user_id']);
  738. if (isset($goods_id)) {
  739. $where['goods_id'] = $goods_id;
  740. $where['user_id'] = $user_id;
  741. $user_goods = M('user_goods')->where($where)->select();
  742. $goods_info = $GLOBALS['db']->getRow("select name,imgs,imgs_details,price,pai_diamonds,kd_cost,score,is_effect from " . DB_PREFIX . "goods where is_effect=1 and id=" . $goods_id);
  743. if ($user_goods) {
  744. $list = M('user_goods')->where($where)->save($goods_info);
  745. } else {
  746. $data = array_merge($where, $goods_info);
  747. $list = M('user_goods')->add($data);
  748. }
  749. if ($list !== false) {
  750. $result['info'] = "上架成功!";
  751. $result['status'] = 1;
  752. } else {
  753. $result['info'] = "上架失败!";
  754. $result['status'] = 0;
  755. }
  756. $this->ajax_return($result);
  757. } else {
  758. $this->error(l("INVALID_OPERATION"), $ajax);
  759. }
  760. }
  761. //下架商品
  762. public function sold()
  763. {
  764. $ajax = intval($_REQUEST['ajax']);
  765. $goods_id = intval($_REQUEST ['id']);
  766. $user_id = intval($_REQUEST ['user_id']);
  767. if (isset($goods_id)) {
  768. $condition['goods_id'] = $goods_id;
  769. $condition['user_id'] = $user_id;
  770. $user_goods = M('user_goods')->where($condition)->select();
  771. if ($user_goods) {
  772. $list = M('user_goods')->where($condition)->delete();
  773. }
  774. if ($list !== false) {
  775. $result['info'] = "下架成功!";
  776. $result['status'] = 1;
  777. } else {
  778. $result['info'] = "下架失败!";
  779. $result['status'] = 0;
  780. }
  781. $this->ajax_return($result);
  782. } else {
  783. $this->error(l("INVALID_OPERATION"), $ajax);
  784. }
  785. }
  786. public function clear_view_count()
  787. {
  788. $sql = "update " . DB_PREFIX . "user set view_count = 0";
  789. $res = $GLOBALS['db']->query($sql);
  790. if ($res) {
  791. $result['info'] = "清除成功!";
  792. $result['status'] = 1;
  793. } else {
  794. $result['info'] = "清除失败!";
  795. $result['status'] = 0;
  796. }
  797. admin_ajax_return($result);
  798. }
  799. public function weibo_index()
  800. {
  801. $common = new UserCommon();
  802. $data = $_REQUEST;
  803. // $data['is_authentication'] = array('in',array(0,1,3));
  804. $data['is_robot'] = 0;
  805. $common->index($data);
  806. }
  807. public function set_sort()
  808. {
  809. $id = intval($_REQUEST['id']);
  810. $sort = intval($_REQUEST['sort']);
  811. $log_info = M("User")->where("id=" . $id)->getField("nick_name");
  812. if (!check_sort($sort)) {
  813. $this->error(l("SORT_FAILED"), 1);
  814. }
  815. M("User")->where("id=" . $id)->setField("weibo_recommend_weight", $sort);
  816. save_log($log_info . l("SORT_SUCCESS"), 1);
  817. $this->success(l("SORT_SUCCESS"), 1);
  818. }
  819. public function game_rate()
  820. {
  821. if ($_POST) {
  822. $user_id = intval($_REQUEST['user_id']);
  823. $rate = intval($_REQUEST['rate']);
  824. if (!$user_id) {
  825. $this->ajax_return(array(
  826. 'status' => 0,
  827. 'error' => '参数错误',
  828. ));
  829. }
  830. if ($rate > 100 || $rate < 0) {
  831. $this->ajax_return(array(
  832. 'status' => 0,
  833. 'error' => '参数错误',
  834. ));
  835. }
  836. $where = array('id' => $user_id);
  837. $user_model = M('user');
  838. $res = $user_model->setField('rate', $rate, $where);
  839. if ($res) {
  840. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php');
  841. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php');
  842. $user_redis = new UserRedisService();
  843. $user_redis->update_db($user_id, ['rate' => $rate]);
  844. $this->ajax_return(array(
  845. 'status' => 1,
  846. 'error' => '更新成功',
  847. ));
  848. }
  849. $this->ajax_return(array(
  850. 'status' => 0,
  851. 'error' => '更新失败',
  852. ));
  853. } else {
  854. $user_id = intval($_REQUEST['user_id']);
  855. $user_model = M('user');
  856. $user_info = $user_model->field(array('id', 'rate'))->find($user_id);
  857. $user_info['rate'] = +$user_info['rate'];
  858. $this->assign("user_info", $user_info);
  859. $this->display();
  860. }
  861. }
  862. protected function ajax_return($data)
  863. {
  864. header("Content-Type:text/html; charset=utf-8");
  865. echo(json_encode($data));
  866. exit;
  867. }
  868. public function game_distribution()
  869. {
  870. if ($_POST) {
  871. $user_id = intval($_REQUEST['user_id']);
  872. $game_distribution1 = intval($_REQUEST['game_distribution1']);
  873. $game_distribution2 = intval($_REQUEST['game_distribution2']);
  874. if (!$user_id) {
  875. $this->ajax_return(array(
  876. 'status' => 0,
  877. 'error' => '参数错误',
  878. ));
  879. }
  880. $where = array('id' => $user_id);
  881. $user_model = M('user');
  882. $res = $user_model->where($where)->save([
  883. 'game_distribution1' => $game_distribution1,
  884. 'game_distribution2' => $game_distribution2
  885. ]);
  886. if ($res) {
  887. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php');
  888. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php');
  889. $user_redis = new UserRedisService();
  890. $user_redis->update_db($user_id,
  891. ['game_distribution1' => $game_distribution1, 'game_distribution2' => $game_distribution2]);
  892. $this->ajax_return(array(
  893. 'status' => 1,
  894. 'error' => '更新成功',
  895. ));
  896. }
  897. $this->ajax_return(array(
  898. 'status' => 0,
  899. 'error' => '更新失败',
  900. ));
  901. } else {
  902. $user_id = intval($_REQUEST['user_id']);
  903. $user_model = M('user');
  904. $user_info = $user_model->field(array('id', 'game_distribution1', 'game_distribution2'))->find($user_id);
  905. $user_info['game_distribution1'] = +$user_info['game_distribution1'];
  906. $user_info['game_distribution2'] = +$user_info['game_distribution2'];
  907. $this->assign("user_info", $user_info);
  908. $this->display();
  909. }
  910. }
  911. public function invitation_code()
  912. {
  913. $user_id = intval($_REQUEST['user_id']);
  914. $user_model = M('user');
  915. $user_info = $user_model->field(['invitation_code', 'create_time'])->find($user_id);
  916. if ($user_info['invitation_code']) {
  917. exit($user_info['invitation_code']);
  918. }
  919. $users = $user_model->field(['id', 'create_time'])->where(['invitation_code' => ''])->findAll();
  920. foreach ($users as $v) {
  921. $res = $user_model->save([
  922. 'invitation_code' => substr(md5($v['id'] . ':' . $v['create_time']), -16),
  923. 'id' => $v['id']
  924. ]);
  925. }
  926. exit(substr(md5($user_id . ':' . $user_info['create_time']), -16));
  927. }
  928. public function game_distribution_detail()
  929. {
  930. $user_id = intval($_REQUEST['user_id']);
  931. if ($_REQUEST['type']) {
  932. $model = M('game_distribution');
  933. $table = DB_PREFIX . 'user u,' . DB_PREFIX . 'game_distribution gd';
  934. $field = "u.id,u.nick_name,u.head_image,sum(gd.first_distreibution_money * (gd.first_distreibution_id = {$user_id}) + gd.second_distreibution_money * (gd.second_distreibution_id = {$user_id})) as `sum`,gd.is_ticket";
  935. $where = "(gd.first_distreibution_id = $user_id or gd.second_distreibution_id = $user_id) and u.id = gd.user_id";
  936. $group = 'u.id,gd.is_ticket';
  937. $list = $model->table($table)->field($field)->where($where)->group($group)->findAll();
  938. $this->assign("list", $list);
  939. } else {
  940. $map = [
  941. 'user_id' => $user_id,
  942. ];
  943. $model = M('game_distribution');
  944. if (!empty($model)) {
  945. $this->_list($model, $map);
  946. }
  947. }
  948. $this->assign("user_id", $user_id);
  949. $this->display();
  950. }
  951. //禁游戏
  952. public function forbid_game()
  953. {
  954. $id = intval($_REQUEST['user_id']);
  955. $open_game = $GLOBALS['db']->getRow("select open_game from " . DB_PREFIX . "user where id =" . $id);
  956. $where = 'id=' . $id;
  957. require_once APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php';
  958. require_once APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php';
  959. $user_redis = new UserRedisService();
  960. $data['open_game'] = 1;
  961. $info = '';
  962. if ($open_game['open_game'] == 1) {
  963. $data['open_game'] = 0;
  964. $info = '取消';
  965. }
  966. $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $data, 'UPDATE', $where);
  967. if ($list !== false) {
  968. $user_redis->update_db($id, $data);
  969. $this->success($info . '禁游戏成功', 1);
  970. } else {
  971. $this->error($info . '禁游戏成功', 1);
  972. }
  973. }
  974. //禁付费
  975. public function forbid_pay()
  976. {
  977. $id = intval($_REQUEST['user_id']);
  978. $open_game = $GLOBALS['db']->getRow("select open_pay from " . DB_PREFIX . "user where id =" . $id);
  979. $where = 'id=' . $id;
  980. require_once APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php';
  981. require_once APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php';
  982. $user_redis = new UserRedisService();
  983. $data['open_pay'] = 1;
  984. $info = '';
  985. if ($open_game['open_pay'] == 1) {
  986. $data['open_pay'] = 0;
  987. $info = '取消';
  988. }
  989. $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $data, 'UPDATE', $where);
  990. if ($list !== false) {
  991. $user_redis->update_db($id, $data);
  992. $this->success($info . '禁付费成功', 1);
  993. } else {
  994. $this->error($info . '禁付费成功', 1);
  995. }
  996. }
  997. //禁竞拍
  998. public function forbid_auction()
  999. {
  1000. $id = intval($_REQUEST['user_id']);
  1001. $open_game = $GLOBALS['db']->getRow("select open_auction from " . DB_PREFIX . "user where id =" . $id);
  1002. $where = 'id=' . $id;
  1003. require_once APP_ROOT_PATH . 'mapi/lib/redis/BaseRedisService.php';
  1004. require_once APP_ROOT_PATH . 'mapi/lib/redis/UserRedisService.php';
  1005. $user_redis = new UserRedisService();
  1006. $data['open_auction'] = 1;
  1007. $info = '';
  1008. if ($open_game['open_auction'] == 1) {
  1009. $data['open_auction'] = 0;
  1010. $info = '取消';
  1011. }
  1012. $list = $GLOBALS['db']->autoExecute(DB_PREFIX . "user", $data, 'UPDATE', $where);
  1013. if ($list !== false) {
  1014. $user_redis->update_db($id, $data);
  1015. $this->success($info . '禁竞拍成功', 1);
  1016. } else {
  1017. $this->error($info . '禁竞拍成功', 1);
  1018. }
  1019. }
  1020. }
  1021. ?>