12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace Admin\Controller;
- use Common\Controller\AdminController;
- class SoftController extends AdminController {
- public function __construct(){
- parent::__construct();
- }
-
- public function index(){
- $os = I('os');
- $condition = array();
- if (!empty($os)){
- $condition['os'] = $os;
- }
- $count = M('Soft')->where($condition)->count();
- //分页
- $Page = new \Think\Page($count);
- $show = $Page->show();
- $softList = M('Soft')->where($condition)->field()->order('soft_id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
- $this->assign('page',$show);
- $this->assign('list',$softList);
- $this->display();
- }
-
- public function edit(){
- $step = I('step','');
- $softId = I('soft_id','');
- if (empty($step)){
- $info = array();
- if (!empty($softId)){
- $info = M('Soft')->where(array('soft_id'=>$softId))->find();
- }
- $this->assign('info',$info);
- $this->display();
- }else if($step==2){
- $data['os'] = I('os');
- $data['force_up'] = I('force_up');
- $data['new_ver'] = I('new_ver');
- $data['up_info'] = I('up_info');
- $data['url'] = I('app_url');
- if (empty($data['up_info'])){
- $this->error('更新内容不能为空');
- }
- if (empty($data['url'])){
- $this->error('app链接不能为空');
- }
- if (empty($softId)){
- $data['operate_dt'] = time();
- M('Soft')->add($data);
- }else{
- M('Soft')->where(array('soft_id'=>$softId))->save($data);
- }
- $this->success('APP操作成功','/admin/soft/index');
- }
- }
-
-
- }
|