Пример #1
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'description' => $_GPC['description'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'bgimg' => $_GPC['bgimg'], 'shareimg' => $_GPC['shareimg'], 'titleimg' => $_GPC['titleimg'], 'helpimg' => $_GPC['helpimg'], 'cameraimg' => $_GPC['cameraimg'], 'numberimg' => $_GPC['numberimg'], "follow_url" => $_GPC['follow_url'], "share_url" => $_GPC['share_url'], "share_title" => $_GPC['share_title'], "share_icon" => $_GPC['share_icon'], "share_desc" => $_GPC['share_desc']);
     //物品
     $item_ids = $_GPC['item_id'];
     $items = array();
     if (is_array($item_ids)) {
         foreach ($item_ids as $key => $value) {
             $d = array("id" => $value, "score" => $_GPC['item_score_' . $value], "rate" => $_GPC['item_rate_' . $value], "name" => $_GPC['item_name_' . $value], "thumb" => $_GPC['item_thumb_' . $value]);
             $items[] = $d;
         }
     }
     $insert['items'] = serialize($items);
     if (empty($id)) {
         $insert['createtime'] = time();
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         $id = pdo_insert('ewei_takephotoa_reply', $insert);
     } else {
         pdo_update('ewei_takephotoa_reply', $insert, array('id' => $id));
     }
     return true;
 }
Пример #2
0
 public function doMobileDetail()
 {
     global $_W, $_GPC;
     checkauth();
     $rid = intval($_GPC['rid']);
     $reply = pdo_fetch("SELECT * FROM " . tablename('shake_reply') . " WHERE rid = :rid", array(':rid' => $rid));
     if (empty($reply)) {
         message('抱歉,此活动不存在或是还未开始!', 'refresh', 'error');
     }
     $member = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid AND openid = :openid", array(':rid' => $reply['rid'], ':openid' => $_W['member']['uid']));
     if (empty($member)) {
         $member = array('rid' => $rid, 'openid' => $_W['member']['uid'], 'createtime' => TIMESTAMP, 'shakecount' => 0, 'status' => 0);
         $maxjoin = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('shake_member') . " WHERE rid = '{$reply['rid']}' AND status = '1'");
         if ($maxjoin < $reply['maxjoin']) {
             mt_srand((double) microtime() * 1000000);
             $rand = mt_rand(1, 100);
             if ($rand <= $reply['joinprobability']) {
                 $member['status'] = 1;
             }
         }
         pdo_insert('shake_member', $member);
     }
     if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) {
         $reply['speed'] = $reply['speedandroid'];
     }
     include $this->template('detail');
 }
Пример #3
0
 public function respond()
 {
     global $_W;
     $msgtype = $this->message['type'];
     $allow = array('text', 'image', 'location', 'link', 'trace');
     if (!in_array($msgtype, $allow)) {
         return $this->respText('抱歉,系统仅支持 文字,图片,地理位置,链接类型的消息!');
     }
     $close = 0;
     if ($msgtype == 'text') {
         $content = $this->message['content'];
         if ($content == '关闭') {
             $content = '<span class="text-danger">系统消息:粉丝关闭了对话</span>';
             $close = 1;
         }
     } elseif ($msgtype == 'image') {
         $content = $this->message['picurl'];
     } elseif ($msgtype == 'location') {
         $content = iserializer(array('location_x' => $this->message['location_x'], 'location_y' => $this->message['location_y'], 'scale' => $this->message['scale']));
     } elseif ($msgtype == 'link') {
         $content = $this->message['url'];
     }
     if (!empty($content)) {
         $insert = array('uniacid' => $_W['uniacid'], 'acid' => $_W['acid'], 'openid' => $_W['openid'], 'msgtype' => $msgtype, 'flag' => 2, 'content' => $content, 'createtime' => TIMESTAMP);
         pdo_insert('mc_chats_record', $insert);
     }
     $this->refreshContext(300);
     if ($close == 1) {
         $this->endContext();
         return $this->respText('您成功关闭回话。');
     }
     return $this->respText('');
 }
Пример #4
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_W, $_GPC;
     load()->func('file');
     $id = intval($_GPC['reply_id']);
     $insert = array("rid" => $rid, "weid" => $_W['uniacid'], "title" => $_GPC['title'], "description" => $_GPC['description'], "rule" => trim($_GPC['rule']), "end_title" => $_GPC['end_title'], "end_description" => $_GPC['end_description'], "starttime" => strtotime($_GPC['datelimit']['start']), "endtime" => strtotime($_GPC['datelimit']['end']), "total_times" => $_GPC['total_times'], "totaldayplay_times" => $_GPC['totaldayplay_times'], "totaldayshare_times" => $_GPC['totaldayshare_times'], "sharelottery_times" => $_GPC['sharelottery_times'], "gametime" => $_GPC['gametime'], "showusernum" => $_GPC['showusernum'], "share_title" => $_GPC['share_title'], "share_desc" => $_GPC['share_desc'], "share_url" => $_GPC['share_url'], "follow_url" => $_GPC['follow_url'], "gameovertext" => $_GPC['gameovertext'], "tips1text" => $_GPC['tips1text'], "tips2text" => $_GPC['tips2text'], "tips3text" => $_GPC['tips3text'], "signtext" => $_GPC['signtext'], "isneedfollow" => $_GPC['isneedfollow'], "awardtip" => $_GPC['awardtip'], "copyright" => $_GPC['copyright']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['picture'] = $_GPC['start_picurl'];
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
     }
     if (!empty($_GPC['share_image'])) {
         $insert['share_image'] = $_GPC['share_image'];
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         pdo_insert($this->table_reply, $insert);
     } else {
         pdo_update($this->table_reply, $insert, array('id' => $id));
     }
 }
Пример #5
0
 public function doMobilePay()
 {
     global $_W, $_GPC;
     if (empty($_W['member']['uid'])) {
         checkauth();
     }
     $username = $_W['member']['email'] ? $_W['member']['email'] : $_W['member']['mobile'];
     if (empty($username)) {
         message('您的用户信息不完整,请完善用户信息后再充值', '', 'error');
     }
     if (checksubmit('submit', true) || !empty($_GPC['ajax'])) {
         $fee = floatval($_GPC['money']);
         if ($fee <= 0) {
             message('支付错误, 金额小于0');
         }
         $chargerecord = pdo_fetch("SELECT * FROM " . tablename('mc_credits_recharge') . " WHERE uniacid = :uniacid AND uid = :uid AND fee = :fee AND status = '0'", array(':uniacid' => $_W['uniacid'], ':uid' => $_W['member']['uid'], ':fee' => $fee));
         if (empty($chargerecord)) {
             $chargerecord = array('uid' => $_W['member']['uid'], 'uniacid' => $_W['uniacid'], 'tid' => date('YmdHi') . random(10, 1), 'fee' => $fee, 'status' => 0, 'createtime' => TIMESTAMP);
             if (!pdo_insert('mc_credits_recharge', $chargerecord)) {
                 message('创建充值订单失败,请重试!', url('entry', array('m' => 'recharge', 'do' => 'pay')), 'error');
             }
         }
         $params = array('tid' => $chargerecord['tid'], 'ordersn' => $chargerecord['tid'], 'title' => '系统充值余额', 'fee' => $chargerecord['fee'], 'user' => $_W['member']['uid']);
         $this->pay($params);
     } else {
         include $this->template('recharge');
     }
 }
Пример #6
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     if (!empty($_GPC['music-title'])) {
         foreach ($_GPC['music-title'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $update = array('title' => $title, 'description' => $_GPC['music-description'][$index], 'url' => $_GPC['music-url'][$index], 'hqurl' => $_GPC['music-hqurl'][$index]);
             if (!empty($_GPC['music-url-old'][$index]) && $_GPC['music-url'][$index] != $_GPC['music-url-old'][$index]) {
                 file_delete($_GPC['music-url-old'][$index]);
             }
             pdo_update($this->tablename, $update, array('id' => $index));
         }
     }
     //处理添加
     if (!empty($_GPC['music-title-new'])) {
         foreach ($_GPC['music-title-new'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $insert = array('rid' => $rid, 'title' => $title, 'description' => $_GPC['music-description-new'][$index], 'url' => $_GPC['music-url-new'][$index], 'hqurl' => $_GPC['music-hqurl-new'][$index]);
             pdo_insert($this->tablename, $insert);
         }
     }
     return true;
 }
Пример #7
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => $_GPC['content'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'repeat_lottery_reply' => $_GPC['repeat_lottery_reply'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'probability' => $_GPC['probability'], 'c_type_one' => $_GPC['c_type_one'], 'c_name_one' => $_GPC['c_name_one'], 'c_num_one' => $_GPC['c_num_one'], 'c_type_two' => $_GPC['c_type_two'], 'c_name_two' => $_GPC['c_name_two'], 'c_num_two' => $_GPC['c_num_two'], 'c_type_three' => $_GPC['c_type_three'], 'c_name_three' => $_GPC['c_name_three'], 'c_num_three' => $_GPC['c_num_three'], 'c_type_four' => $_GPC['c_type_four'], 'c_name_four' => $_GPC['c_name_four'], 'c_num_four' => $_GPC['c_num_four'], 'c_type_five' => $_GPC['c_type_five'], 'c_name_five' => $_GPC['c_name_five'], 'c_num_five' => $_GPC['c_num_five'], 'c_type_six' => $_GPC['c_type_six'], 'c_name_six' => $_GPC['c_name_six'], 'c_num_six' => $_GPC['c_num_six'], 'award_times' => $_GPC['award_times'], 'number_times' => $_GPC['number_times'], 'most_num_times' => $_GPC['most_num_times'], 'sn_code' => $_GPC['sn_code'], 'sn_rename' => $_GPC['sn_rename'], 'tel_rename' => $_GPC['tel_rename'], 'show_num' => $_GPC['show_num'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'share_txt' => $_GPC['share_txt'], 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end']), 'c_rate_one' => $_GPC['c_rate_one'], 'c_rate_two' => $_GPC['c_rate_two'], 'c_rate_three' => $_GPC['c_rate_three'], 'c_rate_four' => $_GPC['c_rate_four'], 'c_rate_five' => $_GPC['c_rate_five'], 'c_rate_six' => $_GPC['c_rate_six']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['start_picurl'] = $_GPC['start_picurl'];
         file_delete($_GPC['start_picurl-old']);
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
         file_delete($_GPC['end_picurl-old']);
     }
     $insert['total_num'] = intval($_GPC['c_num_one']) + intval($_GPC['c_num_two']) + intval($_GPC['c_num_three']) + intval($_GPC['c_num_four']) + intval($_GPC['c_num_five']) + intval($_GPC['c_num_six']);
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     return true;
 }
Пример #8
0
 public function doWebAwardSet()
 {
     global $_GPC, $_W;
     checklogin();
     $id = intval($_GPC['id']);
     $weid = $_W['weid'];
     $from_user = $_W['fans']['from_user'];
     $row = pdo_fetchall("SELECT award FROM " . tablename('mgamblemoon_award_set') . " WHERE weid={$weid} AND awardid in (0,1,2,3,4,5,6,7,8)");
     //print_r($row);
     $names = array('状元插金花', '五红', '五子', '普通状元', '对堂', '四进', '三红', '二举', '一秀');
     if ($_W['ispost']) {
         $award = $_GPC['award'];
         print_r($award);
         foreach ($names as $key => $name) {
             $insert = array('weid' => $weid, 'awardname' => $name, 'awardid' => $key, 'award' => $_GPC[$name], 'createtime' => TIMESTAMP);
             $is = pdo_fetch("SELECT * FROM " . tablename('mgamblemoon_award_set') . "WHERE awardid='{$key}' AND weid = {$weid}");
             if (empty($is)) {
                 pdo_insert('mgamblemoon_award_set', $insert);
             } else {
                 pdo_update('mgamblemoon_award_set', $insert, array('id' => $is['id']));
             }
         }
         $url = $this->createWebUrl('awardset', array('id' => $id));
         message('保存数据成功', $url, success);
     }
     include $this->template('awardset');
 }
Пример #9
0
function rule_insert_keyword($data) {
	if (!isset($data['rid']) || !isset($data['content'])) {
		return error(1, '参数不完整');
	}
	if (isset($data['id'])) {
		$updateid = $data['id'];
	}
	//正则表达式需要验证其合法性
	if ($data['type'] == 3) {
					
	}
	$insert = array(
		'content' => $data['content'],
		'type' => $data['type'],
		'rid' => $data['rid'],
		'weid' => $data['weid'],
		
	);
	!empty($data['module']) && $insert['module'] = $data['module'];
	if (!empty($updateid) && $updateid > 0) {
		$result = pdo_update('rule_keyword', $insert, array('id' => $updateid));
	} else {
		$result = pdo_insert('rule_keyword', $insert);
	}
	if ($result) {
		return true;	
	} else {
		return error(1, '添加记录失败');
	}
}
Пример #10
0
 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['weid'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $_W['weid'], 'iurl' => $_GPC['iurl'], 'appid' => $_GPC['appid'], 'appkey' => $_GPC['appkey'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     include $this->template('routeradd');
 }
Пример #11
0
 public function doWebPost()
 {
     //这个操作被定义用来呈现 管理中心导航菜单
     global $_GPC, $_W;
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->table_stores) . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,位置不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入位置名称!');
         }
         $data = array('uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['reside']['province'], 'city' => $_GPC['reside']['city'], 'dist' => $_GPC['reside']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'icon' => $_GPC['icon'], 'industry1' => $_GPC['industry_1'], 'industry2' => $_GPC['industry_2'], 'createtime' => TIMESTAMP);
         if (empty($id)) {
             pdo_insert($this->table_stores, $data);
         } else {
             unset($data['createtime']);
             pdo_update($this->table_stores, $data, array('id' => $id));
         }
         message('位置信息更新成功!', $this->createWebUrl('list'), 'success');
     }
     load()->func('tpl');
     include $this->template('post');
 }
Пример #12
0
 public function doMobileIndex()
 {
     global $_W, $_GPC;
     checkauth();
     $fromuser = fans_require($_W['fans']['from_user'], array('nickname', 'mobile'), '需要完善资料后才能玩.');
     $rid = $_GPC['rid'];
     $follow = fans_search($_W['fans']['from_user'], array('follow'));
     if ($follow['follow'] == 1) {
         if (intval($_GPC['id'])) {
             $score = pdo_fetchcolumn("select score from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='******'from_user'] . "'");
             if ($score < $_GPC['score']) {
                 $update = array('score' => $_GPC['score'], 'realname' => $fromuser['nickname']);
                 $score = $_GPC['score'];
                 pdo_update('bj_tgame_user', $update, array('id' => $_GPC['id'], 'weid' => $_W['weid']));
             }
             message($score, '', 'ajax');
         }
         $from_user = pdo_fetch("select id from_user, rid from" . tablename('bj_tgame_user') . "where from_user ='******'from_user'] . "'");
         if (empty($from_user['from_user'])) {
             $insert = array('id' => $_GPC['id'], 'weid' => $_W['weid'], 'rid' => $rid, 'from_user' => $fromuser['from_user'], 'realname' => $fromuser['nickname'], 'score' => 0);
             pdo_insert('bj_tgame_user', $insert);
         }
         //$from_user = pdo_fetch("select id, rid from".tablename('bj_tgame_user')."where from_user ='******'from_user']. "'");
         if ($from_user['rid'] != $rid) {
             $update = array('rid' => $rid);
             pdo_update('bj_tgame_user', $update, array('id' => $from_user['id']));
         }
         $realname = $fromuser['nickname'];
         $user = pdo_fetch("select * from" . tablename('bj_tgame_user') . "where rid =" . $rid . ".and from_user ='******'from_user'] . "'");
     }
     $set = pdo_fetch("select * from" . tablename('bj_tgame_reply') . "where rid =" . $rid);
     include $this->template('index');
 }
Пример #13
0
 public function logCredit($_fans, $weid, $from_user, $credittype, $delta, $tag)
 {
     $fans = $_fans->get($weid, $from_user);
     $data = array('weid' => $weid, 'from_user' => $fans['from_user'], 'nickname' => $fans['nickname'], 'credit' => $fans['credit' . $credittype], 'delta' => $delta, 'tag' => $this->getCreditTypeName($credittype) . '-' . $tag, 'createtime' => TIMESTAMP);
     $ret = pdo_insert(self::$t_credit_log, $data);
     return $ret;
 }
Пример #14
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     load()->func('tpl');
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['uniacid'], 'title' => trim($_GPC['title']), 'content' => trim($_GPC['content']), 'description' => trim($_GPC['description']), 'rule' => trim($_GPC['rule']), 'award' => trim($_GPC['award']), 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'number_times' => intval($_GPC['number_times']), 'most_num_times' => intval($_GPC['most_num_times']), 'daysharenum' => intval($_GPC['daysharenum']), 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'dateline' => TIMESTAMP, 'copyright' => $_GPC['copyright'], 'copyrighturl' => $_GPC['copyrighturl'], "gametime" => intval($_GPC['gametime']), "gamelevel" => intval($_GPC['gamelevel']), "number_times" => intval($_GPC['number_times']), "showusernum" => intval($_GPC['showusernum']), "most_num_times" => intval($_GPC['most_num_times']), "daysharenum" => intval($_GPC['daysharenum']), "mode" => intval($_GPC['mode']), "isneedfollow" => intval($_GPC['isneedfollow']), "sharelotterynum" => intval($_GPC['sharelotterynum']), 'share_title' => $_GPC['share_title'], 'share_desc' => $_GPC['share_desc'], 'share_url' => $_GPC['share_url'], 'follow_url' => $_GPC['follow_url']);
     if (!empty($_GPC['start_picurl'])) {
         $insert['start_picurl'] = $_GPC['start_picurl'];
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
     }
     if (!empty($_GPC['share_image'])) {
         $insert['share_image'] = $_GPC['share_image'];
     }
     if (!empty($_GPC['cover'])) {
         $insert['cover'] = $_GPC['cover'];
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         unset($insert['dateline']);
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     return true;
 }
Пример #15
0
 public function doWebRouteradd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['uniacid'];
     //drop list
     $seldata = array('api_id' => $this->module['config']['appid'], 'api_key' => $this->module['config']['appkey']);
     $arrdat = $this->jkvisit('QRYL', $seldata);
     $clist = $arrdat['node_list'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->routertable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的路由器信息不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['rname'])) {
             message('请输入路由器名称!');
         }
         $data = array('rname' => $_GPC['rname'], 'weid' => $weid, 'appid' => $this->module['config']['authid'], 'appkey' => $this->module['config']['authkey'], 'iurl' => $_GPC['iurl'], 'nodeid' => $_GPC['nodeid'], 'status' => $_GPC['status']);
         if (empty($id)) {
             pdo_insert($this->routertable, $data);
         } else {
             pdo_update($this->routertable, $data, array('id' => $id));
         }
         message('路由器信息更新成功!', $this->createWebUrl('routerlist'), 'success');
     }
     load()->func('tpl');
     include $this->template('routeradd');
 }
Пример #16
0
 public function doWebCategory()
 {
     global $_GPC, $_W;
     $op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     $id = intval($_GPC['id']);
     if ($op == 'post') {
         if (!empty($id)) {
             $item = pdo_fetch("SELECT * FROM" . tablename('xfmarket_category') . "WHERE id='{$id}'");
         }
         if ($_W['ispost']) {
             $data = array('weid' => $_W['weid'], 'name' => $_GPC['cname'], 'enabled' => $_GPC['enabled']);
             if (empty($id)) {
                 pdo_insert('xfmarket_category', $data);
             } else {
                 pdo_update('xfmarket_category', $data, array('id' => $id));
             }
             message('更新成功', referer(), 'success');
         }
     } elseif ($op == 'display') {
         $row = pdo_fetchall("SELECT * FROM" . tablename('xfmarket_category') . "WHERE weid='{$_W['weid']}'");
     }
     if (checksubmit('delete')) {
         pdo_delete('xfmarket_category', " id  IN  ('" . implode("','", $_GPC['select']) . "')");
         message('删除成功', referer(), 'success');
     }
     include $this->template('category');
 }
Пример #17
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'picture' => $_GPC['picture'], 'description' => $_GPC['description'], 'periodlottery' => intval($_GPC['periodlottery']), 'maxlottery' => intval($_GPC['maxlottery']), 'rule' => htmlspecialchars_decode($_GPC['rule']), 'default_tips' => $_GPC['default_tips'], 'hitcredit' => intval($_GPC['hitcredit']), 'misscredit' => intval($_GPC['misscredit']));
     if (empty($id)) {
         pdo_insert($this->tablename, $insert);
     } else {
         if (!empty($_GPC['picture'])) {
             file_delete($_GPC['picture-old']);
         } else {
             unset($insert['picture']);
         }
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     if (!empty($_GPC['award-title'])) {
         foreach ($_GPC['award-title'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $update = array('title' => $title, 'description' => $_GPC['award-description'][$index], 'probalilty' => $_GPC['award-probalilty'][$index], 'total' => 1, 'get_jf' => $_GPC['get_jf'][$index]);
             pdo_update('yqs_award', $update, array('id' => $index));
         }
     }
     //处理添加
     if (!empty($_GPC['award-title-new'])) {
         foreach ($_GPC['award-title-new'] as $index => $title) {
             if (empty($title)) {
                 continue;
             }
             $insert = array('rid' => $rid, 'title' => $title, 'description' => $_GPC['award-description-new'][$index], 'probalilty' => $_GPC['award-probalilty-new'][$index], 'inkind' => intval($_GPC['award-inkind-new'][$index]), 'total' => 1, 'get_jf' => intval($_GPC['get_jf-new'][$index]));
             pdo_insert('yqs_award', $insert);
         }
     }
 }
Пример #18
0
 public function receive()
 {
     global $_W, $_GPC;
     load()->model('mc');
     load()->func('communication');
     $event = $this->message['event'];
     $openid = $this->message['from'];
     $f_log = pdo_fetch("SELECT * FROM " . tablename('mc_mapping_fans') . " WHERE `uniacid` = '{$_W['uniacid']}' AND `openid` = '{$openid}'");
     if ($f_log['uid'] != 0) {
         pdo_update('hx_subscribe_data', array('uid' => $f_log['uid']), array('openid' => $openid));
         $uid = $f_log['uid'];
     } else {
         $default_groupid = pdo_fetchcolumn('SELECT groupid FROM ' . tablename('mc_groups') . ' WHERE uniacid = :uniacid AND isdefault = 1', array(':uniacid' => $_W['uniacid']));
         $data = array('uniacid' => $_W['uniacid'], 'email' => md5($openid) . '@qdaygroup.com', 'salt' => random(8), 'groupid' => $default_groupid, 'createtime' => TIMESTAMP);
         $data['password'] = md5($message['from'] . $data['salt'] . $_W['config']['setting']['authkey']);
         pdo_insert('mc_members', $data);
         $uid = pdo_insertid();
         pdo_update('mc_mapping_fans', array('uid' => $uid), array('openid' => $openid));
         pdo_update('hx_subscribe_data', array('uid' => $uid), array('openid' => $openid));
     }
     $credit_type = isset($this->module['config']['credit_type']) ? $this->module['config']['credit_type'] : 'credit1';
     $credit_subscribe = isset($this->module['config']['credit_subscribe']) ? $this->module['config']['credit_subscribe'] : 5;
     $credit_lever_1 = isset($this->module['config']['credit_lever_1']) ? $this->module['config']['credit_lever_1'] : 2;
     $credit_lever_2 = isset($this->module['config']['credit_lever_2']) ? $this->module['config']['credit_lever_2'] : 1;
     if ($event == 'subscribe') {
         $s_log = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `openid`='{$openid}'");
         if (empty($s_log)) {
             //如果没记录
             $insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'uid' => $uid, 'from_uid' => '0', 'sn' => time(), 'follow' => '1', 'article_id' => '0', 'shouyi' => $credit_subscribe, 'createtime' => TIMESTAMP);
             pdo_insert('hx_subscribe_data', $insert);
             mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分'));
         } else {
             //如果有记录
             if ($s_log['follow'] != 1) {
                 //如果记录未关注
                 $insert = array('follow' => '1');
                 pdo_update('hx_subscribe_data', $insert, array('id' => $s_log['id']));
                 mc_credit_update($uid, $credit_type, $credit_subscribe, array('1', '关注增加积分'));
             }
             if (!empty($s_log['from_uid'])) {
                 //如果来源ID不为空
                 $from_user = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$s_log['from_uid']}'");
                 if (!empty($from_user)) {
                     $data = array('shouyi' => $from_user['shouyi'] + $credit_lever_1, 'zjrs' => $from_user['zjrs'] + 1);
                     pdo_update('hx_subscribe_data', $data, array('id' => $from_user['id']));
                     mc_credit_update($s_log['from_uid'], $credit_type, $credit_lever_1, array('1', '推荐一级关注增加积分'));
                     if (!empty($from_user['from_uid'])) {
                         $from_user_2 = pdo_fetch("SELECT * FROM " . tablename('hx_subscribe_data') . " WHERE `uniacid`='{$_W['uniacid']}' AND `uid`='{$from_user['from_uid']}'");
                         if (!empty($from_user_2)) {
                             $data2 = array('shouyi' => $from_user_2['shouyi'] + $credit_lever_2, 'jjrs' => $from_user_2['jjrs'] + 1);
                             pdo_update('hx_subscribe_data', $data2, array('id' => $from_user_2['id']));
                             mc_credit_update($from_user['from_uid'], $credit_type, $credit_lever_2, array('1', '推荐二级关注增加积分'));
                         }
                     }
                 }
             }
         }
         //pdo_update('hx_subscribe_data',array('follow'=>1),array('openid'=>$openid));
     }
 }
Пример #19
0
/**
 * [WeEngine System] Copyright (c) 2014 WE7.CC
 * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
 */
function site_cover($coverparams = array())
{
    $where = '';
    $params = array(':uniacid' => $coverparams['uniacid'], ':module' => $coverparams['module']);
    if (!empty($coverparams['multiid'])) {
        $where .= " AND multiid = :multiid";
        $params[':multiid'] = $coverparams['multiid'];
    }
    $cover = pdo_fetch("SELECT * FROM " . tablename('cover_reply') . " WHERE `module` = :module AND uniacid = :uniacid {$where}", $params);
    if (empty($cover['rid'])) {
        $rule = array('uniacid' => $coverparams['uniacid'], 'name' => $coverparams['title'], 'module' => 'cover', 'status' => 1);
        pdo_insert('rule', $rule);
        $rid = pdo_insertid();
    } else {
        $rule = array('name' => $coverparams['title']);
        pdo_update('rule', $rule, array('id' => $cover['rid']));
        $rid = $cover['rid'];
    }
    if (!empty($rid)) {
        $sql = 'DELETE FROM ' . tablename('rule_keyword') . ' WHERE `rid`=:rid AND `uniacid`=:uniacid';
        $pars = array();
        $pars[':rid'] = $rid;
        $pars[':uniacid'] = $coverparams['uniacid'];
        pdo_query($sql, $pars);
        $keywordrow = array('rid' => $rid, 'uniacid' => $coverparams['uniacid'], 'module' => 'cover', 'status' => 1, 'displayorder' => 0, 'type' => 1, 'content' => $coverparams['keyword']);
        pdo_insert('rule_keyword', $keywordrow);
    }
    $entry = array('uniacid' => $coverparams['uniacid'], 'multiid' => $coverparams['multiid'], 'rid' => $rid, 'title' => $coverparams['title'], 'description' => $coverparams['description'], 'thumb' => $coverparams['thumb'], 'url' => $coverparams['url'], 'do' => '', 'module' => $coverparams['module']);
    if (empty($cover['id'])) {
        pdo_insert('cover_reply', $entry);
    } else {
        pdo_update('cover_reply', $entry, array('id' => $cover['id']));
    }
    return true;
}
Пример #20
0
function user_register($user)
{
    if (empty($user) || !is_array($user)) {
        return 0;
    }
    if (isset($user['uid'])) {
        unset($user['uid']);
    }
    $user['salt'] = random(8);
    $user['password'] = user_hash($user['password'], $user['salt']);
    $user['joinip'] = CLIENT_IP;
    $user['joindate'] = TIMESTAMP;
    $user['lastip'] = CLIENT_IP;
    $user['lastvisit'] = TIMESTAMP;
    if (empty($user['status'])) {
        $user['status'] = 2;
    }
    $now = time();
    if (empty($user['endtime'])) {
        $user['endtime'] = $now + 7 * 24 * 3600;
    }
    $result = pdo_insert('users', $user);
    if (!empty($result)) {
        $user['uid'] = pdo_insertid();
    }
    return intval($user['uid']);
}
Пример #21
0
 public function doWebPost()
 {
     global $_GPC, $_W;
     if (empty($_GPC['do'])) {
         $_GPC['do'] = 'post';
     }
     $id = intval($_GPC['id']);
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename('business') . " WHERE id = :id", array(':id' => $id));
         if (empty($item)) {
             message('抱歉,商户不存在或是已经删除!', '', 'error');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['title'])) {
             message('请输入商户名称!');
         }
         $data = array('weid' => $_W['weid'], 'title' => $_GPC['title'], 'content' => htmlspecialchars_decode($_GPC['content']), 'phone' => $_GPC['phone'], 'qq' => $_GPC['qq'], 'province' => $_GPC['district']['province'], 'city' => $_GPC['district']['city'], 'dist' => $_GPC['district']['district'], 'address' => $_GPC['address'], 'lng' => $_GPC['baidumap']['lng'], 'lat' => $_GPC['baidumap']['lat'], 'industry1' => $_GPC['industry']['parent'], 'industry2' => $_GPC['industry']['child'], 'createtime' => TIMESTAMP);
         if (!empty($_GPC['thumb'])) {
             $data['thumb'] = $_GPC['thumb'];
             load()->func('file');
             file_delete($_GPC['thumb-old']);
         }
         if (empty($id)) {
             pdo_insert('business', $data);
         } else {
             unset($data['createtime']);
             pdo_update('business', $data, array('id' => $id));
         }
         message('商户信息更新成功!', $this->createWebUrl('display'), 'success');
     }
     include $this->template('post');
 }
Пример #22
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $this->weid, 'title' => $_GPC['title'], 'kptime' => strtotime($_GPC['kptime']), 'rztime' => strtotime($_GPC['rztime']), 'kfs' => $_GPC['kfs'], 'price' => $_GPC['price'], 'lpaddress' => $_GPC['lpaddress'], 'sltel' => $_GPC['sltel'], 'zxtel' => $_GPC['zxtel'], 'news_title' => $_GPC['news_title'], 'news_icon' => $_GPC['news_icon'], 'news_content' => $_GPC['news_content'], 'share_title' => $_GPC['share_title'], 'share_icon' => $_GPC['share_icon'], 'share_content' => $_GPC['share_content'], 'order_title' => $_GPC['order_title'], 'order_remark' => $_GPC['order_remark'], 'cover_img' => $_GPC['cover_img'], 'overview_img' => $_GPC['overview_img'], 'intro_img' => $_GPC['intro_img'], 'dt_img' => $_GPC['dt_img'], 'dt_intro' => htmlspecialchars_decode($_GPC['dt_intro']), 'intro' => htmlspecialchars_decode($_GPC['intro']), 'createtime' => TIMESTAMP);
     if (empty($id)) {
         $id = pdo_insert($this->table_hosue, $insert);
     } else {
         pdo_update($this->table_hosue, $insert, array('id' => $id));
     }
     ///说明项处理
     $house_ids = $_GPC['house_ids'];
     $house_names = $_GPC['house_iname'];
     $house_conents = $_GPC['house_icontent'];
     $house_sorts = $_GPC['house_sort'];
     pdo_query("delete from " . tablename($this->table_house_item) . " where hid=:hid", array(":hid" => $id));
     if (is_array($house_ids)) {
         foreach ($house_ids as $key => $value) {
             $value = intval($value);
             $d = array("rid" => $rid, "hid" => $id, "iname" => $house_names[$key], "icontent" => $house_conents[$key], "sort" => $house_sorts[$key]);
             pdo_insert($this->table_house_item, $d);
         }
     }
     return true;
 }
Пример #23
0
 public function fieldsFormSubmit($rid)
 {
     global $_W, $_GPC;
     $id = intval($_GPC['replyid']);
     $data = array('rid' => $rid, 'weid' => $_W['weid'], 'sn' => $_GPC['sn'], 'token' => $_GPC['apitoken'], 'maxuse' => intval($_GPC['maxuse']), 'maxtotal' => intval($_GPC['maxtotal']), 'adtype' => intval($_GPC['adtype']), 'adurlv' => $_GPC['adurlv'], 'adurlh' => $_GPC['adurlh'], 'admsg' => $_GPC['admsg'], 'leavemsg' => $_GPC['leavemsg'], 'fontfamily' => $_GPC['fontfamily'], 'fontcolor' => $_GPC['fontcolor'], 'qrcode' => $_GPC['qrcode'], 'mainpic' => $_GPC['mainpic'], 'adpics' => '', 'width' => $_GPC['width'], 'height' => $_GPC['height'], 'size' => intval($_GPC['photosize']), 'status' => intval($_GPC['status']), 'enableauthcode' => intval($_GPC['enableauthcode']), 'enablemsg' => intval($_GPC['enablemsg']), 'content' => $_GPC['content'], 'tipsentry' => $_GPC['tipsentry'], 'tipssuccess' => $_GPC['tipssuccess'], 'tipserror' => $_GPC['tipserror']);
     if (!empty($_GPC['sort'])) {
         asort($_GPC['sort']);
         foreach ($_GPC['sort'] as $key => $value) {
             $data['adpics'][] = $_GPC['adpics'][$key];
         }
         $data['adpics'] = iserializer($data['adpics']);
     } else {
         $data['adpics'] = iserializer($_GPC['adpics']);
     }
     if (empty($id)) {
         pdo_insert('we7_photomaker', $data);
     } else {
         if (!empty($_GPC['qrcode'])) {
             file_delete($_GPC['qrcode-old']);
         }
         if (!empty($_GPC['mainpic'])) {
             file_delete($_GPC['mainpic-old']);
         }
         pdo_update('we7_photomaker', $data, array('id' => $id));
     }
 }
Пример #24
0
 public function doWebsetting()
 {
     global $_W, $_GPC;
     $weid = $_W['uniacid'];
     load()->func('tpl');
     $subject = pdo_fetch("SELECT * FROM " . tablename(hc_ybdzs_setting) . " WHERE weid = '{$weid}' ORDER BY id DESC LIMIT 1");
     $item['hc_ybdzs_title'] = empty($item['hc_ybdzs_title']) ? '月饼大战' : $item['hc_ybdzs_title'];
     $item['share_desc'] = empty($item['share_desc']) ? '我只用了一层功力,已经无人可及了!' : $item['share_desc'];
     $item['wechat'] = empty($item['wechat']) ? '导流标题' : $item['wechat'];
     $item['hc_ybdzs_url'] = empty($item['hc_ybdzs_url']) ? 'http://52jscn.com' : $item['hc_ybdzs_url'];
     if (checksubmit()) {
         $data = array('hc_ybdzs_title' => $_GPC['hc_ybdzs_title'], 'hc_ybdzs_url' => $_GPC['hc_ybdzs_url'], 'share_desc' => $_GPC['share_desc'], 'wechat' => $_GPC['wechat'], 'counts' => $_GPC['counts'], 'photo' => $_GPC['photo']);
         if (empty($subject)) {
             $data['weid'] = $weid;
             pdo_insert(hc_ybdzs_setting, $data);
         } else {
             pdo_update(hc_ybdzs_setting, $data, array('weid' => $weid));
         }
         message('欧了!欧了!更新完毕!', referer(), 'success');
     }
     if (!$subject['photo']) {
         $subject = array("photo" => "../addons/hc_ybdzs/template/mobile/b.gif");
     }
     include $this->template('setting');
 }
Пример #25
0
 public function doWebCsadd()
 {
     global $_GPC, $_W;
     $id = $_GPC['id'];
     $weid = $_W['weid'];
     if (!empty($id)) {
         $item = pdo_fetch("SELECT * FROM " . tablename($this->cstable) . " WHERE weid=:weid and id=:id", array(':weid' => $weid, ':id' => $id));
         if (empty($item)) {
             message('抱歉,您编辑的客服资料不存在或已删除');
         }
     }
     if (checksubmit('submit')) {
         if (empty($_GPC['openid'])) {
             message('请输入客服openid!');
         }
         $data = array('workid' => $_GPC['workid'], 'weid' => $_W['weid'], 'openid' => $_GPC['openid'], 'csid' => $_GPC['csid'], 'start_time' => $_GPC['start_time'], 'end_time' => $_GPC['end_time'], 'busy' => $_GPC['busy']);
         if (empty($id)) {
             pdo_insert($this->cstable, $data);
         } else {
             pdo_update($this->cstable, $data, array('id' => $id));
         }
         message('客服信息更新成功!', $this->createWebUrl('cslist'), 'success');
     }
     include $this->template('csadd');
 }
Пример #26
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'weid' => $_W['weid'], 'title' => $_GPC['title'], 'ticket_information' => $_GPC['ticket_information'], 'description' => $_GPC['description'], 'end_theme' => $_GPC['end_theme'], 'end_instruction' => $_GPC['end_instruction'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'isshow' => intval($_GPC['isshow']), 'isdes' => intval($_GPC['isdes']), 'sendtimes' => intval($_GPC['sendtimes']), 'daysendtimes' => intval($_GPC['daysendtimes']), 'starttime' => strtotime($_GPC['datelimit-start']), 'endtime' => strtotime($_GPC['datelimit-end']));
     if (!empty($_GPC['start_picurl'])) {
         $insert['start_picurl'] = $_GPC['start_picurl'];
         file_delete($_GPC['start_picurl-old']);
     }
     if (!empty($_GPC['end_picurl'])) {
         $insert['end_picurl'] = $_GPC['end_picurl'];
         file_delete($_GPC['end_picurl-old']);
     }
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['status'] = 1;
         } else {
             $insert['status'] = 0;
         }
         $id = pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
     return true;
 }
Пример #27
0
 /**
  * 保存一条用户记录至用户表中, 如果OpenID存在, 则更新记录
  * @param array $entity     用户数据
  * @return int|error        成功返回用户编号, 失败返回错误信息
  */
 public function save($entity)
 {
     global $_W;
     $rec = array_elements(array('openid', 'nickname', 'gender', 'state', 'city', 'country', 'avatar'), $entity);
     $rec['uniacid'] = $_W['uniacid'];
     $sql = 'SELECT * FROM ' . tablename('mbsk_fans') . ' WHERE `uniacid`=:uniacid AND `openid`=:openid';
     $pars = array();
     $pars[':uniacid'] = $rec['uniacid'];
     $pars[':openid'] = $rec['openid'];
     $exists = pdo_fetch($sql, $pars);
     if (!empty($exists)) {
         $filter = array();
         $filter['uniacid'] = $_W['uniacid'];
         $filter['uid'] = $exists['uid'];
         $ret = pdo_update('mbsk_fans', $rec, $filter);
         if ($ret !== false) {
             return $exists['uid'];
         } else {
             return error(-2, '数据更新失败, 请稍后重试');
         }
     }
     $ret = pdo_insert('mbsk_fans', $rec);
     if (!empty($ret)) {
         return pdo_insertid();
Пример #28
0
 public function fieldsFormSubmit($rid)
 {
     //规则验证无误保存入库时执行,这里应该进行自定义字段的保存。这里 $rid 为对应的规则编号
     global $_GPC, $_W;
     $currentprompt = trim($_GPC['currentprompt']) ? trim($_GPC['currentprompt']) : '当前数字是 {LUCKYNUM}!';
     $awardprompt = trim($_GPC['awardprompt']) ? trim($_GPC['awardprompt']) : '恭喜您,当前数字是 {LUCKYNUM},获得 {AWARD} 奖品!';
     $data = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'luckynumstart' => $_GPC['luckynumstart'], 'luckynumfilter' => $_GPC['luckynumfilter'], 'show_instruction' => $_GPC['show_instruction'], 'time_instruction' => $_GPC['time_instruction'], 'limit_instruction' => $_GPC['limit_instruction'], 'end_instruction' => $_GPC['end_instruction'], 'awardnum_instruction' => $_GPC['awardnum_instruction'], 'award_instruction' => $_GPC['award_instruction'], 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']), 'limittype' => $_GPC['limittype'], 'awardnum' => $_GPC['awardnum'], 'ticketinfo' => $_GPC['ticketinfo'], 'isrealname' => $_GPC['isrealname'], 'ismobile' => $_GPC['ismobile'], 'isqq' => $_GPC['isqq'], 'isemail' => $_GPC['isemail'], 'isaddress' => $_GPC['isaddress'], 'isgender' => $_GPC['isgender'], 'istelephone' => $_GPC['istelephone'], 'isidcard' => $_GPC['isidcard'], 'iscompany' => $_GPC['iscompany'], 'isoccupation' => $_GPC['isoccupation'], 'isposition' => $_GPC['isposition'], 'isfans' => $_GPC['isfans'], 'isfansname' => $_GPC['isfansname'], 'currentprompt' => $currentprompt, 'awardprompt' => $awardprompt, 'sponsors1' => $_GPC['sponsors1'], 'sponsors1link' => $_GPC['sponsors1link'], 'sponsors2' => $_GPC['sponsors2'], 'sponsors2link' => $_GPC['sponsors2link'], 'sponsors3' => $_GPC['sponsors3'], 'sponsors3link' => $_GPC['sponsors3link'], 'sponsors4' => $_GPC['sponsors4'], 'sponsors4link' => $_GPC['sponsors4link'], 'sponsors5' => $_GPC['sponsors5'], 'sponsors5link' => $_GPC['sponsors5link'], 'ruletext' => $_GPC['ruletext'], 'title' => $_GPC['title'], 'shareimg' => $_GPC['shareimg'], 'sharetitle' => $_GPC['sharetitle'], 'sharedesc' => $_GPC['sharedesc']);
     $id = pdo_fetchcolumn("SELECT id FROM " . tablename('stonefish_luckynum') . " WHERE rid = :rid", array(':rid' => $rid));
     //if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
     if (empty($id)) {
         $data['isshow'] = 1;
         pdo_insert('stonefish_luckynum', $data);
     } else {
         pdo_update('stonefish_luckynum', $data, array('id' => $id));
     }
     //}
     //update
     if (!empty($_GPC['award_number'])) {
         foreach ($_GPC['award_number'] as $key => $val) {
             $update_data = array('numbers' => $_GPC['award_number'][$key], 'title' => $_GPC['award_title'][$key], 'description' => $_GPC['award_desc'][$key]);
             //if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
             pdo_update($this->tablename, $update_data, array('id' => $key));
             //}
         }
     }
     //insert
     if (!empty($_GPC['newaward_number'])) {
         foreach ($_GPC['newaward_number'] as $key => $val) {
             $new_data = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'numbers' => $_GPC['newaward_number'][$key], 'title' => $_GPC['newaward_title'][$key], 'description' => $_GPC['newaward_desc'][$key], 'dateline' => $_W['timestamp']);
             //if ($_GPC['shouquan']==$_GPC['we7_ValidCode_server']){
             pdo_insert($this->tablename, $new_data);
             //}
         }
     }
 }
Пример #29
0
 public function fieldsFormSubmit($rid = 0)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $credit = intval($_GPC['credit']);
     $insert = array('rid' => $rid, 'start_time' => strtotime($_GPC['start_time']), 'end_time' => strtotime($_GPC['end_time']), 'awardrules' => $_GPC['awardrules'], 'awardinfo' => $_GPC['awardinfo'], 'days' => $_GPC['days'], 'credit' => $credit);
     if (!empty($_FILES['thumb']['tmp_name'])) {
         file_delete($_GPC['thumb_old']);
         $upload = file_upload($_FILES['thumb']);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $insert['thumb'] = $upload['path'];
     } else {
         $tmp_file = array(name => "registration_top.jpg", tmp_name => "{$_SERVER['DOCUMENT_ROOT']}/source/modules/cgtsignin/template/style/images/registration_top.jpg");
         $upload = file_upload($tmp_file);
         if (is_error($upload)) {
             message($upload['message'], '', 'error');
         }
         $insert['thumb'] = $upload['path'];
     }
     if (empty($id)) {
         pdo_insert($this->tablename, $insert);
     } else {
         pdo_update($this->tablename, $insert, array('id' => $id));
     }
 }
Пример #30
0
 public function fieldsFormSubmit($rid)
 {
     global $_GPC, $_W;
     $id = intval($_GPC['reply_id']);
     $insert = array('rid' => $rid, 'uniacid' => $_W['uniacid'], 'title' => $_GPC['title'], 'thumb' => $_GPC['thumb'], 'description' => $_GPC['description'], 'detail' => htmlspecialchars_decode($_GPC['detail']), 'followurl' => $_GPC['followurl'], 'createtime' => time(), 'copyright' => $_GPC['copyright'], 'start' => $_GPC['start'], 'end' => $_GPC['end'], 'joincount' => intval($_GPC['joincount']), 'points' => intval($_GPC['points']), 'starttime' => strtotime($_GPC['datelimit']['start']), 'endtime' => strtotime($_GPC['datelimit']['end']));
     //规则
     $rule_ids = $_GPC['rule_id'];
     $rule_points = $_GPC['rule_point'];
     $rule_starts = $_GPC['rule_start'];
     $rule_ends = $_GPC['rule_end'];
     $rule_caches = array();
     if (is_array($rule_ids)) {
         foreach ($rule_ids as $key => $value) {
             $value = intval($value);
             $d = array("point" => $rule_points[$key], "start" => $rule_starts[$key], "end" => $rule_ends[$key]);
             $rule_caches[] = $d;
         }
     }
     $insert['rules'] = serialize($rule_caches);
     if (empty($id)) {
         if ($insert['starttime'] <= time()) {
             $insert['isshow'] = 1;
         } else {
             $insert['isshow'] = 0;
         }
         $id = pdo_insert('ewei_bonus_reply', $insert);
     } else {
         pdo_update('ewei_bonus_reply', $insert, array('id' => $id));
     }
     //基础数据缓存
     $insert['id'] = $id;
     $d = pdo_fetch("select * from " . tablename('ewei_bonus_reply') . " where rid=:rid limit 1", array(":rid" => $rid));
     $this->write_cache($rid, $d);
     return true;
 }