public function update()
 {
     B('FilterString');
     $data = M(MODULE_NAME)->create();
     switch ($data['status']) {
         case 0:
             $action = 'wait';
             break;
         case 1:
             $action = 'success';
             break;
         case 2:
             $action = 'failed';
             break;
         case 3:
             $action = 'waitpay';
             break;
         case 4:
             $action = 'reback';
             break;
         default:
             $action = 'index';
             break;
     }
     // 更新数据
     $list = M(MODULE_NAME)->save($data);
     if ($list > 0) {
         $sdata['update_time'] = TIME_UTC;
         $sdata['id'] = $data['id'];
         M(MODULE_NAME)->save($sdata);
         //成功提示
         $vo = M(MODULE_NAME)->where("id=" . $data['id'])->find();
         $user_id = $vo['user_id'];
         $user_info = M("User")->where("id=" . $user_id)->find();
         require_once APP_ROOT_PATH . "/system/libs/user.php";
         if ($data['status'] == 1) {
             //提现
             modify_account(array("lock_money" => -$vo['money']), $vo['user_id'], "提现成功", 8);
             modify_account(array("lock_money" => -$vo['fee']), $vo['user_id'], "提现成功", 9);
             $content = "您于" . to_date($vo['create_time'], "Y年m月d日 H:i:s") . "提交的" . format_price($vo['money']) . "提现申请汇款成功,请查看您的资金记录。";
             $group_arr = array(0, $user_id);
             sort($group_arr);
             $group_arr[] = 6;
             $msg_data['content'] = $content;
             $msg_data['to_user_id'] = $user_id;
             $msg_data['create_time'] = TIME_UTC;
             $msg_data['type'] = 0;
             $msg_data['group_key'] = implode("_", $group_arr);
             $msg_data['is_notice'] = 6;
             $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg_data);
             $id = $GLOBALS['db']->insert_id();
             $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set group_key = '" . $msg_data['group_key'] . "_" . $id . "' where id = " . $id);
             //短信通知
             if (app_conf("SMS_ON") == 1) {
                 $tmpl = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_CARYY_SUCCESS_SMS'");
                 $tmpl_content = $tmpl['content'];
                 $notice['user_name'] = $user_info["user_name"];
                 $notice['carry_money'] = $vo['money'];
                 $notice['site_name'] = app_conf("SHOP_TITLE");
                 $GLOBALS['tmpl']->assign("notice", $notice);
                 $msg = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content);
                 $msg_data['dest'] = $user_info['mobile'];
                 $msg_data['send_type'] = 0;
                 $msg_data['title'] = "提现成功短信提醒";
                 $msg_data['content'] = addslashes($msg);
                 $msg_data['send_time'] = 0;
                 $msg_data['is_send'] = 0;
                 $msg_data['create_time'] = TIME_UTC;
                 $msg_data['user_id'] = $user_info['id'];
                 $msg_data['is_html'] = $tmpl['is_html'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_msg_list", $msg_data);
                 //插入
             }
         } elseif ($data['status'] == 2) {
             //驳回
             modify_account(array("money" => $vo['money'], "lock_money" => -$vo['money']), $vo['user_id'], "提现失败", 8);
             modify_account(array("money" => $vo['fee'], "lock_money" => -$vo['fee']), $vo['user_id'], "提现失败", 9);
             $content = "您于" . to_date($vo['create_time'], "Y年m月d日 H:i:s") . "提交的" . format_price($vo['money']) . "提现申请被我们驳回,驳回原因\"" . $data['msg'] . "\"";
             $group_arr = array(0, $user_id);
             sort($group_arr);
             $group_arr[] = 7;
             $msg_data['content'] = $content;
             $msg_data['to_user_id'] = $user_id;
             $msg_data['create_time'] = TIME_UTC;
             $msg_data['type'] = 0;
             $msg_data['group_key'] = implode("_", $group_arr);
             $msg_data['is_notice'] = 7;
             $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg_data);
             $id = $GLOBALS['db']->insert_id();
             $GLOBALS['db']->query("update " . DB_PREFIX . "msg_box set group_key = '" . $msg_data['group_key'] . "_" . $id . "' where id = " . $id);
         }
         save_log("编号为" . $data['id'] . "的提现申请" . L("UPDATE_SUCCESS"), 1);
         //开始验证有效性
         $this->assign("jumpUrl", u(MODULE_NAME . "/" . $action));
         parent::success(L("UPDATE_SUCCESS"));
     } else {
         //错误提示
         $DBerr = M()->getDbError();
         save_log("编号为" . $data['id'] . "的提现申请" . L("UPDATE_FAILED") . $DBerr, 0);
         $this->error(L("UPDATE_FAILED") . $DBerr, 0);
     }
 }
Пример #2
0
 public function delete()
 {
     //彻底删除指定记录
     $ajax = intval($_REQUEST['ajax']);
     $id = $_REQUEST['id'];
     if (isset($id)) {
         $condition = array('id' => array('in', explode(',', $id)));
         $list = M(MODULE_NAME)->where($condition)->delete();
         if ($list !== false) {
             save_log(l("FOREVER_DELETE_SUCCESS"), 1);
             parent::success(l("FOREVER_DELETE_SUCCESS"), $ajax);
         } else {
             save_log(l("FOREVER_DELETE_FAILED"), 0);
             $this->error(l("FOREVER_DELETE_FAILED"), $ajax);
         }
     } else {
         $this->error(l("INVALID_OPERATION"), $ajax);
     }
 }
Пример #3
0
 public function saveconfig()
 {
     $config = $_POST['config'];
     $has_ids = null;
     foreach ($config['id'] as $k => $v) {
         if (intval($v) > 0) {
             $has_ids[] = $v;
         }
     }
     M()->query("DELETE FROM " . DB_PREFIX . "user_carry_config WHERE id not in (" . implode(",", $has_ids) . ")");
     foreach ($config['id'] as $k => $v) {
         if (intval($v) > 0) {
             $config_data = array();
             $config_data['id'] = $v;
             $config_data['name'] = trim($config['name'][$k]);
             $config_data['min_price'] = floatval($config['min_price'][$k]);
             $config_data['max_price'] = floatval($config['max_price'][$k]);
             $config_data['fee'] = floatval($config['fee'][$k]);
             $config_data['vip_id'] = intval($config['vip_id'][$k]);
             $config_data['fee_type'] = intval($config['fee_type'][$k]);
             M("UserCarryConfig")->save($config_data);
         }
     }
     $aconfig = $_POST['aconfig'];
     foreach ($aconfig['name'] as $k => $v) {
         if (trim($v) != "") {
             $config_data = array();
             $config_data['name'] = trim($v);
             $config_data['min_price'] = floatval($aconfig['min_price'][$k]);
             $config_data['max_price'] = floatval($aconfig['max_price'][$k]);
             $config_data['fee'] = floatval($aconfig['fee'][$k]);
             $config_data['vip_id'] = intval($aconfig['vip_id'][$k]);
             $config_data['fee_type'] = intval($aconfig['fee_type'][$k]);
             M("UserCarryConfig")->add($config_data);
         }
     }
     rm_auto_cache("user_carry_config");
     parent::success(L("UPDATE_SUCCESS"));
 }
Пример #4
0
 function do_reback()
 {
     $id = intval($_REQUEST['id']);
     if ($id == 0) {
         $this->error("操作失败", 0);
         die;
     }
     $id = intval($_REQUEST['id']);
     $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id);
     if ($deal_id == 0) {
         $this->error("不存在的债权");
         die;
     }
     $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and  d.publish_wait=0 ';
     $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id ";
     $transfer = get_transfer($union_sql, $condition);
     if ($transfer['t_user_id'] > 0) {
         $this->error("债权已转让,无法撤销", 0);
         die;
     }
     $msg = strim($_POST['msg']);
     if ($msg == "") {
         $this->error("请输入撤销原因", 0);
         die;
     }
     $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "deal_load_transfer SET status=0 WHERE id=" . $id);
     if ($GLOBALS['db']->affected_rows() > 0) {
         $notice['shop_title'] = app_conf("SHOP_TITLE");
         $notice['url'] = "“<a href=\"" . url("index", "transfer#detail", array("id" => $v['id'])) . "\">Z-" . $v['load_id'] . "</a>”";
         $notice['msg'] = "因为:“" . $msg . "”被管理员撤销了";
         $tmpl_content = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "msg_template where name = 'TPL_DEAL_SUCCESS_SITE_SMS'", false);
         $GLOBALS['tmpl']->assign("notice", $notice);
         $content = $GLOBALS['tmpl']->fetch("str:" . $tmpl_content['content']);
         send_user_msg("", $content, 0, $transfer['user_id'], TIME_UTC, 0, true, 17);
         save_log("撤销编号:{$id的债券转让}", 1);
         parent::success("撤销成功!");
         die;
     } else {
         save_log("撤销编号:{$id的债券转让}", 0);
         $this->error("撤销失败!");
         die;
     }
 }
 function do_reback()
 {
     $id = intval($_REQUEST['id']);
     if ($id == 0) {
         $this->error("操作失败", 0);
         die;
     }
     $id = intval($_REQUEST['id']);
     $deal_id = $GLOBALS['db']->getOne("SELECT deal_id FROM " . DB_PREFIX . "deal_load_transfer WHERE id=" . $id);
     if ($deal_id == 0) {
         $this->error("不存在的债权");
         die;
     }
     $condition = ' AND dlt.id=' . $id . ' AND d.deal_status >= 4 and d.is_effect=1 and d.is_delete=0 and d.repay_time_type =1 and  d.publish_wait=0 ';
     $union_sql = " LEFT JOIN " . DB_PREFIX . "deal_load_transfer dlt ON dlt.deal_id = dl.deal_id ";
     $transfer = get_transfer($union_sql, $condition);
     if ($transfer['t_user_id'] > 0) {
         $this->error("债权已转让,无法撤销", 0);
         die;
     }
     $msg = strim($_POST['msg']);
     if ($msg == "") {
         $this->error("请输入撤销原因", 0);
         die;
     }
     $GLOBALS['db']->query("UPDATE  " . DB_PREFIX . "deal_load_transfer SET status=0 WHERE id=" . $id);
     if ($GLOBALS['db']->affected_rows() > 0) {
         $content = "您好,您在" . app_conf("SHOP_TITLE") . "转让的债权 “<a href=\"" . url("index", "transfer#detail", array("id" => $id)) . "\">Z-" . $transfer['load_id'] . "</a>” 因为:“" . $msg . "”被管理员撤销了";
         send_user_msg("", $content, 0, $transfer['user_id'], TIME_UTC, 0, true, 17);
         save_log("撤销编号:{$id的债券转让}", 1);
         parent::success("撤销成功!");
         die;
     } else {
         save_log("撤销编号:{$id的债券转让}", 0);
         $this->error("撤销失败!");
         die;
     }
 }