public function save($id = 0) { if ($pid = pri_id(U('Index/index'))) { if (M('book')->where('id=%d AND pri_id=%d', $id, $pid)->save($_POST)) { return $this->success('保存成功'); } } $this->success('保存失败'); }
public function feedback() { $Form = D('Home/Feedback'); $_POST['message'] = $_POST['message'] . '##FromPrinterID:' . pri_id('index'); if ($Form->create()) { $result = $Form->add(); if ($result) { $this->success('操作成功!'); } else { $this->error('写入错误!'); } } else { $this->error($Form->getError()); } }
/** * @method send * * @author 云小印[yunyin.org] * * @param $pid,$fid */ public function send() { $pid = pri_id(U('Index/index')); if ($pid) { $fid = I('fid', null, 'intval'); $map['pri_id'] = $pid; $map['id'] = $fid; $map['status'] = array('eq', C('FILE_PRINTED')); $map['sended'] = 0; $File = D('FileView'); $info = $File->where($map)->field('use_id,phone,name')->find(); $Printer = M('Printer'); $info['pri_name'] = M('Printer')->getFieldById($pid, 'name'); if ($info['phone'] && $info['name']) { unset($info['phone']); if (mb_strlen($info['name']) > 18) { $info['name'] = mb_substr($info['name'], 0, 18); } $phone = get_phone_by_id($info['use_id']); unset($info['use_id']); $info['fid'] = $fid; $SMS = new \Vendor\Sms(); if ($SMS->printed($phone, $info)) { $File = M('File'); $map['id'] = $fid; $result = $File->where($map)->setField('sended', 1); $this->success('提醒信息已发送'); } else { $this->error('发送不成功'); } } else { $this->success('已发送'); } } else { $this->error('请先登录'); } }
/** * @method download * * @author 云小印[yunyin.org] * * @param $pid,$fid * @return $download_url */ public function download() { $pid = pri_id(U('Index/index')); $fid = I('fid', null, 'intval'); $map['pri_id'] = $pid; $map['id'] = $fid; $map['status'] = array('gt', 0); $File = M('File'); $info = $File->where($map)->field('url,status,copies,ppt_layout,color,double_side,name')->find(); if ($info) { if ($info['copies']) { $file_name = $info['copies'] . '份_' . ($info['double_side'] ? '双面_' : '单面_') . ($info['color'] ? '彩印_' : '黑白_'); if ($ppt_layout = $info['ppt_layout']) { $layouts = C('PPT_LAYOUT'); $file_name .= $layouts[$ppt_layout] . '版_'; } } else { $file_name = '到店打印_'; } $file_name = $file_name . "[{$fid}]" . $info['name']; redirect(download_file($info['url'], 'attname=' . urlencode($file_name))); } else { $this->error('文件已删除,不能再下载!'); } }
/** * 修改信息 * @method changeInfo * * @author 云小印[yunyin.org] * * @param pri_id * @param 各种各样信息 */ public function changeInfo() { $id = pri_id(U('Index/index')); if ($id) { //$data = $_POST; $data['qq'] = I('qq'); $data['phone'] = I('phone'); $data['address'] = I('address'); $data['profile'] = I('profile'); $data['open_time'] = I('open_time'); $data['email'] = I('email'); $price['p_c_s'] = I('p_c_s', 0, 'float'); //color single $price['p_c_d'] = I('p_c_d', 0, 'float'); //color double $price['p_s'] = I('p_s', 0, 'float'); //no color single $price['p_d'] = I('p_d', 0, 'float'); //no color double $data['price'] = json_encode($price); $data['price_more'] = I('price_more'); //price more $result = M('Printer')->where('id=' . $id)->save($data); if ($result) { $this->success('改好了'); } else { $this->error('出错了'); } } else { $this->error('信息不完整'); } }