public function get_index() { //echo md5('qieyou');exit; f61e83b9c803be5003ceddacfc6010ba $name = input_mobilenum($this->input->get('name'), '1004'); $password = $this->input->get('password'); $device = $this->input->get('device'); $device_id = $this->input->get('device_id'); if (empty($password)) { response_msg('1002'); } $user = $this->model->get_user_by_name($name); if (!$user) { response_msg('1003'); } $password = md5($password . $user['salt']); if ($user['user_pass'] != $password) { response_msg('1002'); } if ($user['state'] == 'locked') { response_msg('1006'); } $user['inn_id'] = $this->model->get_user_inn_by_id($user['user_id']); if (!$user['inn_id']) { response_msg('1006'); } $data['token'] = $this->model->create_token($user); $data['role'] = $user['role']; $data['state'] = $user['state']; // $this->user_model->update_login_info($user); response_data($data); }
/** * 用户token获取 **/ public function userLogin() { $username = check_empty(trimall(strip_tags($this->input->post('username', TRUE))), FALSE, '1002'); $password = check_empty(trimall(strip_tags($this->input->post('password', TRUE))), FALSE, '1003'); //f61e83b9c803be5003ceddacfc6010ba $namelen = strlen($username); if ($namelen < 4 || $namelen > 16) { response_code('1002'); } $passlen = strlen($password); if ($passlen != 32) { response_code('1003'); } $user = $this->model->get_user_auth_by_name($username); if (!$user) { response_code('1004'); } //密码错误 if (md5($password . $user['salt']) != $user['user_pass']) { response_code('1004'); } if ($user['role'] == 'innholder') { $inn = $this->model->get_user_inn($user['user_id']); $user['inn_id'] = $inn['inn_id']; } $data['token'] = $this->create_token($user); response_data($data); }
public function customerList() { $page = input_int($this->input->get('page'), 1, FALSE, FALSE, '1015'); //分页 $perpage = input_int($this->input->get('perpage'), 1, FALSE, FALSE, '1016'); //分页 $search = $this->input->get('search'); $this->load->model('partners_model'); $data = $this->partners_model->get_list($this->token['user_id'], $page, $perpage, $search); response_data($data); }
/** * 评论详情 **/ public function comment() { $comment_id = input_int($this->input->get('comment_id'), 1, FALSE, FALSE, '2004'); $comment = $this->model->get_comment_detail($comment_id); if (!$comment) { response_code('2004'); } $user_id = $this->get_user_id(); $comment['is_like'] = '0'; if ($user_id) { $comment['is_like'] = $this->model->check_comment_fav($comment_id, $user_id); } response_data(array('comment' => $comment)); }
/** * 删除消息 * * @author Vonwey <*****@*****.**> * @CreateDate: 2015-5-29 下午5:50:03 */ public function delMessage() { $id = input_int($this->input->get('msg_id')); $user_id = $this->get_user_id(TRUE); $this->load->model('message_model'); // 判断消息是否已删除 $status = $this->message_model->is_message_deled($id, $user_id); if ($status == 1) { response_code('1026'); } elseif ($status == 0) { response_code('1027'); } $re = intval($this->message_model->del_message($id)) . ''; response_data($re); }
public function detail() { $inn_id = $this->get_inn_id(TRUE); $inn = $this->finance_model->get_user_inn_by_inn_id($inn_id, FALSE); if (!$inn) { response_code('1006'); } $data['account'] = $inn['account']; // 账号余额 $data['order_divide'] = $inn['order_divide']; // 自营收入 $data['balance_divide'] = $inn['balance_divide']; // 代销收入 $data['amount'] = floatval($data['order_divide']) + floatval($data['balance_divide']); // 累计收入 // $data['amount'] = $inn['amount']; // 待确认 $data['withdrawing'] = $inn['withdrawing']; // 提现中 // $data['amount'] = $inn['amount']; // 已提现 response_data($data); }
/** * 处理上传 * * @param array $sourceArr 要上传的文件信息数组 * @param string $to 上传文件存放的文件夹,相对 * @param array $data 要插入或修改的数据数组信息 * @param array $thumb 缩略图信息,只需要设置宽度和高度即可 * @return bool 成否与否 */ public function index() { $this->check_token(); $type = input_string($this->input->get('type'), array('userheadimg', 'innheadimg', 'product'), FALSE, '5002'); $thumbs = array(); switch ($type) { case 'innheadimg': $thumbs[] = array('width' => 100, 'height' => 100, 'thumb_marker' => 's', 'maintain_ratio' => FALSE); $link = 'inn/header/'; break; case 'userheadimg': $thumbs[] = array('width' => 100, 'height' => 100, 'thumb_marker' => 's', 'maintain_ratio' => FALSE); $link = 'user/headimg/'; break; case 'product': $thumbs[] = array('width' => 640, 'height' => 440, 'thumb_marker' => 'm', 'maintain_ratio' => TRUE); $thumbs[] = array('width' => 160, 'height' => 110, 'thumb_marker' => 's', 'maintain_ratio' => TRUE); $link = 'uploads/'; break; } $rs = $this->getUploadedNames($link); if ($rs['code'] != '1') { response_msg('4000'); } if ($thumbs) { $this->load->library('image_lib'); foreach ($thumbs as $key => $thumb) { $thumb = array_merge($this->thumbConfig, $thumb); log_message('error', json_encode($thumb)); $thumb['source_image'] = $this->config->item('uploaded_img_path') . $link . $rs['msg']; log_message('error', $thumb['source_image']); $this->image_lib->initialize($thumb); $this->image_lib->resize(); } } response_data($link . $rs['msg']); }
/** * 添加商品 POST * 各种类型商品数据类型差别很大 SO分开处理 */ public function addProduct() { $this->check_token(); $data = $this->check_product_value('add'); $data['inn_id'] = $this->token['inn_id']; $data['state'] = 'Y'; $data['create_time'] = $_SERVER['REQUEST_TIME']; $data['update_time'] = $_SERVER['REQUEST_TIME']; $product_id = $this->model->insert($data, 'products'); if ($product_id) { response_data($product_id); } response_msg('4000'); }
public function getLine() { response_data($this->model->getAllData($this->token['user_id'])); }
public function partners() { $partners = $this->model->get_user_partner_by_user_id($this->token['user_id']); response_data($partners); }
/** * 商户子账户管理 * 访问权限:innholder only */ public function subview() { $user_id = input_int($this->input->get('uid'), 1, FALSE, FALSE, '1019'); $innInfo = $this->model->get_inn_info_by_inn_id($this->token['inn_id'], FALSE); if ($this->token['user_id'] != $innInfo['innholder_id']) { response_msg('1018'); } $data = $this->model->get_sub_detail_by_user_id($this->token['inn_id'], $user_id); if (!$data) { response_msg('1020'); } response_data($data); }
public function city() { $city = array(array('name' => '丽江', 'city' => '530700'), array('name' => '大理', 'city' => '532900')); response_data($city); }
public function updateHistory() { response_data($this->manager_model->updateHistory()); }