Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
6dabe42b
Commit
6dabe42b
authored
Jul 05, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
718bc6ef
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
302 additions
and
0 deletions
+302
-0
Broker.php
application/api_broker/controller/Broker.php
+0
-0
OfficeUPhoneFollowUpImg.php
application/model/OfficeUPhoneFollowUpImg.php
+151
-0
UPhoneFollowUpImg.php
application/model/UPhoneFollowUpImg.php
+151
-0
No files found.
application/api_broker/controller/Broker.php
View file @
6dabe42b
This diff is collapsed.
Click to expand it.
application/model/OfficeUPhoneFollowUpImg.php
0 → 100644
View file @
6dabe42b
<?php
namespace
app\model
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/7/5
* Time : 10:15
* Intro:
*/
use
think\Db
;
use
think\Exception
;
use
Think\Log
;
class
OfficeUPhoneFollowUpImg
extends
BaseModel
{
protected
$table
=
"office_u_phone_follow_up_img"
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* 新增多张图片
* @param $params
* @param $img_id
* @param $img_type
* @return int|string
* @throws Exception xx
*/
public
function
addImgAll
(
int
$img_id
,
int
$img_type
,
array
$params
)
:
int
{
$imgBin
=
[];
foreach
(
$params
as
$item
)
{
$insert_
[
"img_id"
]
=
$img_id
;
$insert_
[
"img_type"
]
=
$img_type
;
$insert_
[
"img_name"
]
=
$item
;
$insert_
[
"img_status"
]
=
0
;
array_push
(
$imgBin
,
$this
->
imgBin
(
$insert_
));
}
Db
::
startTrans
();
try
{
$this
->
saveAll
(
$imgBin
);
Db
::
commit
();
return
1
;
}
catch
(
Exception
$exception
)
{
Db
::
rollback
();
throw
$exception
;
}
}
/**
* 修改图片单张
* @param array $params
* @return int
* @throws Exception
*/
public
function
updateImgStatus
(
array
$params
)
:
int
{
$imgBin
=
$this
->
imgBin
(
$params
);
Db
::
startTrans
();
try
{
$this
->
update
(
$imgBin
);
Db
::
commit
();
return
$params
[
"id"
];
}
catch
(
Exception
$exception
)
{
Db
::
rollback
();
throw
$exception
;
}
}
/**
* 批量删除
* @param $where
* @param $params
* @return int|string
*/
public
function
updateImgs
(
$where
,
$params
)
{
Db
::
startTrans
();
try
{
$id
=
$this
->
db_
->
where
(
$where
)
->
update
(
$params
);
Db
::
commit
();
return
$id
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* 根据id和类型获取图片
* @param array $params
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getImgList
(
array
$params
,
string
$field
=
"id,img_name"
)
{
if
(
isset
(
$params
[
"img_id"
]))
{
$where_
[
"img_id"
]
=
$params
[
"img_id"
];
}
if
(
isset
(
$params
[
"img_type"
]))
{
$where_
[
"img_type"
]
=
$params
[
"img_type"
];
}
$where_
[
"img_status"
]
=
0
;
$data
=
$this
->
db_
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
// echo $this->getLastSql();
return
$data
;
}
/**
* bin
* @param $params
* @return array
*/
private
function
imgBin
(
$params
)
{
$arr
=
[];
if
(
isset
(
$params
[
"id"
]))
{
$arr
[
"id"
]
=
$params
[
"id"
];
}
else
{
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
if
(
isset
(
$params
[
"img_id"
]))
{
$arr
[
"img_id"
]
=
$params
[
"img_id"
];
}
if
(
isset
(
$params
[
"img_type"
]))
{
$arr
[
"img_type"
]
=
$params
[
"img_type"
];
}
if
(
isset
(
$params
[
"img_name"
]))
{
$arr
[
"img_name"
]
=
$params
[
"img_name"
];
}
if
(
isset
(
$params
[
"img_status"
]))
{
$arr
[
"img_status"
]
=
$params
[
"img_status"
];
}
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
}
\ No newline at end of file
application/model/UPhoneFollowUpImg.php
0 → 100644
View file @
6dabe42b
<?php
namespace
app\model
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2019/7/5
* Time : 10:15
* Intro:
*/
use
think\Db
;
use
think\Exception
;
use
Think\Log
;
class
UPhoneFollowUpImg
extends
BaseModel
{
protected
$table
=
"u_phone_follow_up_img"
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
/**
* 新增多张图片
* @param $params
* @param $img_id
* @param $img_type
* @return int|string
* @throws Exception xx
*/
public
function
addImgAll
(
int
$img_id
,
int
$img_type
,
array
$params
)
:
int
{
$imgBin
=
[];
foreach
(
$params
as
$item
)
{
$insert_
[
"img_id"
]
=
$img_id
;
$insert_
[
"img_type"
]
=
$img_type
;
$insert_
[
"img_name"
]
=
$item
;
$insert_
[
"img_status"
]
=
0
;
array_push
(
$imgBin
,
$this
->
imgBin
(
$insert_
));
}
Db
::
startTrans
();
try
{
$this
->
saveAll
(
$imgBin
);
Db
::
commit
();
return
1
;
}
catch
(
Exception
$exception
)
{
Db
::
rollback
();
throw
$exception
;
}
}
/**
* 修改图片单张
* @param array $params
* @return int
* @throws Exception
*/
public
function
updateImgStatus
(
array
$params
)
:
int
{
$imgBin
=
$this
->
imgBin
(
$params
);
Db
::
startTrans
();
try
{
$this
->
update
(
$imgBin
);
Db
::
commit
();
return
$params
[
"id"
];
}
catch
(
Exception
$exception
)
{
Db
::
rollback
();
throw
$exception
;
}
}
/**
* 批量删除
* @param $where
* @param $params
* @return int|string
*/
public
function
updateImgs
(
$where
,
$params
)
{
Db
::
startTrans
();
try
{
$id
=
$this
->
db_
->
where
(
$where
)
->
update
(
$params
);
Db
::
commit
();
return
$id
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* 根据id和类型获取图片
* @param array $params
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getImgList
(
array
$params
,
string
$field
=
"id,img_name"
)
{
if
(
isset
(
$params
[
"img_id"
]))
{
$where_
[
"img_id"
]
=
$params
[
"img_id"
];
}
if
(
isset
(
$params
[
"img_type"
]))
{
$where_
[
"img_type"
]
=
$params
[
"img_type"
];
}
$where_
[
"img_status"
]
=
0
;
$data
=
$this
->
db_
->
field
(
$field
)
->
where
(
$where_
)
->
select
();
// echo $this->getLastSql();
return
$data
;
}
/**
* bin
* @param $params
* @return array
*/
private
function
imgBin
(
$params
)
{
$arr
=
[];
if
(
isset
(
$params
[
"id"
]))
{
$arr
[
"id"
]
=
$params
[
"id"
];
}
else
{
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
if
(
isset
(
$params
[
"img_id"
]))
{
$arr
[
"img_id"
]
=
$params
[
"img_id"
];
}
if
(
isset
(
$params
[
"img_type"
]))
{
$arr
[
"img_type"
]
=
$params
[
"img_type"
];
}
if
(
isset
(
$params
[
"img_name"
]))
{
$arr
[
"img_name"
]
=
$params
[
"img_name"
];
}
if
(
isset
(
$params
[
"img_status"
]))
{
$arr
[
"img_status"
]
=
$params
[
"img_status"
];
}
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment