chengkun
2025-05-23 a6f7b382623096b6a00924f418447cf5204e825e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
 
class subject_add_controller extends train{
  
    function index_action(){
 
        $UserinfoM    =    $this->MODEL('userinfo');
        $TrainM        =    $this->MODEL('train');
 
 
        $train    =    $UserinfoM->getUserInfo(array('uid'=>$this->uid),array('usertype'=>'4','field'=>'name,r_status'));
        if($train['name']==""){
            $this->ACT_msg("index.php?c=info","请先完善基本资料!");
        }
        $teach    =    $TrainM->getPxTeacherNum(array('uid'=>$this->uid,'status'=>1));
        $this->yunset("teach",$teach);
        
        $tinfo    =    $TrainM->getTeaList(array('uid'=>$this->uid,'status'=>1),array('field'=>'id,name'));
        $this->yunset("teachinfo",$tinfo);
        
        $row    =    $TrainM->getSubInfo(array('uid'=>$this->uid,'id'=>(int)$_GET['id']));
        $row['type']=@explode(",",$row['type']);
        $row['teachid']=@explode(',',$row['teachid']);
        $this->yunset("row",$row);
        $this->yunset("train",$train);
        $this->yunset($this->MODEL('cache')->GetCache(array('city','subject','subjecttype')));
 
        $this->train_satic();
 
        $this->train_tpl('subject_add');
    }
    function save_action(){
 
        $TrainM        =    $this->MODEL('train');
 
        $pinfo        =    $this->pxInfo;
        
        $rstatus    =    $pinfo['r_status'];
        
        $post    =    array(
            'name'            =>    $_POST['name'],
            'nid'            =>    $_POST['nid'],
            'tnid'            =>    $_POST['tnid'],
            'provinceid'    =>    $_POST['provinceid'],
            'cityid'        =>    $_POST['cityid'],
            'threecityid'    =>    $_POST['threecityid'],
            'address'        =>    $_POST['address'],
            'hours'            =>    $_POST['hours'],
            'price'            =>    $_POST['price'],
            'isprice'        =>    $_POST['isprice'],
            'moblie'        =>    $_POST['moblie'],
            'crowd'            =>    $_POST['crowd'],
            'superiority'    =>    $_POST['superiority'],
            'content'        =>    $_POST['content'],
            'r_status'        =>    $rstatus,
            'type'            =>    pylode(',',$_POST['type']),
            'teachid'        =>    pylode(',',$_POST['teachid']),
            'file'            =>    $_FILES['file'],
            'status'        =>    0
        );
        $row    =    $TrainM->getSubInfo(array('uid'=>$this->uid,'id'=>(int)$_POST['id'],'pic'=>array('<>','')));
        
        $data=array(
            'post'        =>    $post,
            'id'        =>    (int)$_POST['id'],
            'uid'        =>    $this->uid,
            'usertype'    =>    $this->usertype,
            'did'        =>    $this->userdid
        );
 
        $return    =    $TrainM->addSubjectInfo($data);
        $this->ACT_layer_msg($return['msg'],$return['errcode'],$return['url']);
    }
}
?>