新手献上的
- function delete1(id) {
- alert(id);
- $.post("/Member/deleteCard", {
- 'id':id
- }, function(data) {
- data = eval('(' + data + ')');
- if (data.code == 1) {
- alert("删除成功!");
- redirectNav('/Member/base_namecard', 'contentDiv');
- }
- else {
- alert("删除失败!");
- redirectNav('/Member/base_namecard', 'contentDiv');
- }
- });
- }
-
- $(function(){
- var id= $("#id").val();
-
-
- ids=id.split(",");
- for(var i=0;i { var a=$("#"+ids[i]);
-
- a.parent().find("span").remove();
- a.parent().prepend("冻结");
- a.parent().prepend("启用/");
- a.remove();
- }
- $("#scard tr td a").click(function(){
- if($(this).text() == "冻结"){
-
- var id=$(this).attr("id");
- if(null!= id)
- {
-
- $.post('/Member/stopCard',
- {
- id:id
- }
- ,function(data,status)
- {
-
-
- data=eval('('+data+')');
- if(data.code==1)
- {
- var show=$("#"+id);
- show.parent().find("span").remove();
- show.parent().prepend("冻结");
- show.parent().prepend("启用/");
- show.remove();
- redirectNav('/member/base_namecard','contentDiv','id=51');
-
- return;
- }
- }
- );
-
-
- }
-
-
-
- }
- else if($(this).text() == "启用/"){
- var id=$(this).attr("id");
-
- if(null!= id)
- {
-
-
-
-
- $.post('/Member/startCard',
- {
- id:id
-
- }
- ,function(data,status)
- {
-
-
- data=eval('('+data+')');
- if(data.code==1)
- {
- var hide=$("#"+id);
- hide.parent().find("span").remove();
- hide.parent().prepend("冻结");
- hide.parent().prepend("启用/");
- hide.remove();
- redirectNav('/member/base_namecard','contentDiv','id=51');
- return;
- }
-
- }
-
- );
- }
-
-
- }
- });
-
- });
-
-
-
複製程式碼
-
/**
- * 聯名卡管理
- * @author shendoudou
- *
- */
- import ('@.Model.Platform.CommonModel');
- class IcbccardModel 擴充 Common Commonl {
- public function findAllCard(){
- $result = $this->select();
- if ($result === false)
- throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
- return $result;
- }
-
- public function findOneCard($id){
- $map['id']=$id;
- $result = $this->where ($map)-> ; find();
- if ($result === false)
- throw new DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
- return $result;
- }
-
- public function updateCard($id,$data){
- $map['id']=$id;
- $result = $this-> where($map)->save($data);
- if ($result === false)
- throw new DBException ( $this->getModelName (), $this->getDbError (), $this ->getLastSql () );
- return $result;
- }
-
- public function deleteCard($id){
- $map['id' ]=$id;
- $ result = $this->where($map)->delete();
- if ($result === false)
- throw new DBException ( $this->getModelName (), $this->getDbError ( ), $this->getLastSql () );
- return $result;
- }
-
- public function findStatusId($status){
- $map['status']=$status;
- $result = $this->where($map)-> ; field('id')->select();
- if ($result === false)
- throw new DBException ( $this->getModelName (), $this->getDbError () , $this- >getLastSql () );
- return $result;
-
- }
-
- public function changeCardStatus($id,$status){
- $map['id ']=$id ;
- $map['status']=$status;
- $result = $this->save($map);
- if ($result === false)
- 提交新的DBException ( $this->getModelName (), $this->getDbError (), $this->getLastSql () );
- return $result;
- }
-
-
-
-
-
- }
-
- ?>
複製程式碼
|