Пример #1
0
 public function coll_store($info, $type)
 {
     if ($type == 'set_coll') {
         $info['status'] = 1;
         $count = $this->getOne("select count(*) from " . $this->table('store_fav') . " where store_id=" . $info['store_id'] . " and wxid=" . $info['wxid']);
         if ($count > 0) {
             $temp = $info;
             unset($temp['store_id']);
             unset($temp['wxid']);
             $data = yf_set_update($temp);
             $sql = "update " . $this->table('store_fav') . " set " . $data . " where store_id=" . $info['store_id'] . " and wxid=" . $info['wxid'];
         } else {
             $data = yf_set_insert($info);
             $sql = "insert into " . $this->table('store_fav') . " (" . $data['key'] . ") values (" . $data['val'] . ")";
         }
     } else {
         $info['status'] = 0;
         $temp = $info;
         unset($temp['store_id']);
         unset($temp['wxid']);
         $data = yf_set_update($temp);
         $sql = "update " . $this->table('store_fav') . " set " . $data . " where store_id=" . $info['store_id'] . " and wxid=" . $info['wxid'];
     }
     return $this->query($sql);
 }
Пример #2
0
 /**
  * 创建关键字或绑定
  * @param unknown $info
  * @return multitype:number string Ambigous <boolean, void, multitype:, string>
  */
 public function create_key($info)
 {
     $result = array('error' => 0, 'content' => '');
     $data = yf_set_insert($info);
     $sql = "INSERT INTO " . $this->table('wxkeyword') . " (" . $data['key'] . ") VALUES(" . $data['val'] . ")";
     if (!($res = $this->query($sql))) {
         $result['error'] = 1;
         $result['content'] = Lang('SQL_ERROR');
     }
     return $result;
 }
Пример #3
0
 /**
  * 更新微信规则
  * @param $info
  * @param $content
  * @param $id
  * @return 
  */
 public function update_rule($info, $content, $id)
 {
     $result = array('error' => 0, 'content' => '');
     if ($id) {
         $info['modifytime'] = yf_time();
         $data = yf_set_update($info);
         $sql = "UPDATE " . $this->table('rule') . " SET " . $data . " WHERE id='" . $id . "'";
         $res = $this->query($sql);
         if (!$res) {
             $result['error'] = 1;
             $result['content'] = Lang('SQL_ERROR');
         } else {
             if (is_array($content)) {
                 if (is_array($content) && count($content) > 0) {
                     foreach ($content as $key => $val) {
                         $content[$key]['rid'] = $id;
                     }
                     $error = 0;
                     foreach ($content as $kk => $vv) {
                         $reply_id = "";
                         if (!empty($vv['id'])) {
                             $reply_id = $vv['id'];
                         }
                         unset($vv['id']);
                         if (!empty($reply_id)) {
                             $yf_data = yf_set_update($vv);
                             $sql = "update " . $this->table('news_reply') . " set " . $yf_data . " where id=" . $reply_id;
                             if (!($res = $this->query($sql))) {
                                 $error++;
                             }
                         } else {
                             $yf_data = yf_set_insert($vv);
                             $sql = "insert into " . $this->table('news_reply') . " (" . $yf_data['key'] . ") values (" . $yf_data['val'] . ")";
                             if (!($res = $this->query($sql))) {
                                 $error++;
                             }
                         }
                     }
                     if ($error != 0) {
                         $result['error'] = 1;
                         $result['content'] = Lang('SQL_ERROR');
                     }
                 }
             } else {
                 $sql = "UPDATE " . $this->table('basic_reply') . " SET content='" . $content . "' WHERE rid='" . $id . "'";
                 $res = $this->query($sql);
             }
         }
     }
     return $result;
 }
Пример #4
0
 /**
  * 插入数据进表单
  * @param $info
  * @return 
  */
 public function insert_table($info)
 {
     if ($info) {
         $data = yf_set_insert($info);
         $sql = "insert into " . $this->table('forms_word') . " (" . $data['key'] . ") values (" . $data['val'] . ")";
         $this->query($sql);
         $id = $this->insert_id();
         if ($id) {
             $data_name = $this->getOne("select data from " . $this->table('fields') . " where id=" . $info['fields_id']);
             $sql = "ALTER TABLE " . $this->table('forms_log') . "_" . $info['form_id'] . " ADD `" . $data_name . "` " . $info['type'] . "(" . $info['type_size'] . ")";
             $this->query($sql);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Пример #5
0
 /**
  * 插入权限详细信息
  * @param $info;插入的关联数组
  * @return boolean;
  */
 public function ins_act($info)
 {
     if ($info) {
         $data = yf_set_insert($info);
         $sql = "insert into " . $this->table('admin_action') . " (" . $data['key'] . ") values (" . $data['val'] . ")";
         $this->query($sql);
         if ($this->insert_id()) {
             $this->query("update " . $this->table('admin_action_list') . " set action_child=action_child+1 where action_id=" . $info['action_id']);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Пример #6
0
 /**
  * 插入文章信息
  * @param $info
  * @param $photo
  * @return
  */
 public function create_art($info, $photo)
 {
     if ($info) {
         $data = yf_set_insert($info);
         $sql = "INSERT INTO " . $this->table('store_goods') . " (" . $data['key'] . ") VALUES(" . $data['val'] . ")";
         $this->query($sql);
         $aid = $this->insert_id();
         if (!$aid) {
             return false;
         } else {
             if (count($photo) > 0) {
                 $sql = "INSERT INTO " . $this->table('album_photos') . " (`aid`, `original_pic`) VALUES";
                 foreach ($photo as $k => $v) {
                     $sql .= "('{$aid}','{$v}'),";
                 }
                 $sql = substr($sql, 0, strlen($sql) - 1);
                 $this->query($sql);
             }
         }
         return true;
     }
     return false;
 }
Пример #7
0
 /**
  * 插入菜单数据
  * @param $info
  * @return boolean
  */
 public function insert_menu($info)
 {
     if ($info) {
         $data = yf_set_insert($info);
         $sql = "INSERT INTO " . $this->table('category') . " (" . $data['key'] . ") VALUES(" . $data['val'] . ")";
         $this->query($sql);
         if ($this->insert_id()) {
             return true;
         } else {
             return false;
         }
     }
     return false;
 }
Пример #8
0
 public function insert_store($info)
 {
     $data = yf_set_insert($info);
     $sql = "insert into " . $this->table('store') . " (" . $data['key'] . ") values (" . $data['val'] . ")";
     $this->query($sql);
     return $this->insert_id();
 }
Пример #9
0
 public function insert_send($info)
 {
     $data = yf_set_insert($info);
     $sql = "insert into " . $this->table('send_comment') . " (" . $data['key'] . ") values (" . $data['val'] . ")";
     return $this->query($sql);
 }
Пример #10
0
 public function update_info($info, $info2, $wxid)
 {
     $data = yf_set_update($info);
     $sql = "update " . $this->table('wxusers') . " set " . $data . " where wxid=" . $wxid;
     $this->query($sql);
     $count = $this->getOne("select count(*) from " . $this->table('user') . " where wxid=" . $wxid);
     if ($count > 0) {
         $data2 = yf_set_update($info2);
         $sql = "update " . $this->table('user') . " set " . $data2 . " where wxid=" . $wxid;
     } else {
         $info2['wxid'] = $wxid;
         $data2 = yf_set_insert($info2);
         $sql = "insert into " . $this->table('user') . " (" . $data2['key'] . ") values (" . $data2['val'] . ")";
     }
     return $this->query($sql);
 }
Пример #11
0
 /**
  * 插入版块内容
  * @param $info
  * @return 
  */
 public function add_images($info)
 {
     if ($info) {
         $data = yf_set_insert($info);
         $sql = "INSERT INTO " . $this->table('block_content') . " (" . $data['key'] . ") VALUES(" . $data['val'] . ")";
         $res = $this->query($sql);
         if ($this->insert_id()) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Пример #12
0
 public function insert_into_wxuser($info)
 {
     $data = yf_set_insert($info);
     $sql = "insert into " . $this->table('wxusers') . " (" . $data['key'] . ") values (" . $data['val'] . ")";
     if ($this->query($sql)) {
         return $this->insert_id();
     } else {
         return false;
     }
 }